Skip to content

Commit 8af37cc

Browse files
committed
Updated Dickerfile
* Bumped Ruby to 2.4.2 * Shrank image 2.4x * Removed git that is only used for docs * Removed test gems
1 parent b9ba6db commit 8af37cc

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

Dockerfile

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
FROM ruby:2.3-alpine
1+
FROM ruby:2.4-alpine
22

33
WORKDIR /usr/src/app
4-
COPY Gemfile /usr/src/app/
5-
COPY Gemfile.lock /usr/src/app/
64

7-
RUN gem install bundler && \
8-
bundle install -j 4 && \
9-
rm -fr /usr/share/ri
5+
RUN adduser -u 9000 -D app
106

11-
RUN apk --update add git
7+
COPY Gemfile Gemfile.lock /usr/src/app/
8+
9+
RUN gem install bundler && \
10+
bundle install -j 4 --without=test && \
11+
chown -R app:app /usr/local/bundle && \
12+
rm -fr ~/.gem ~/.bundle ~/.wh..gem
1213

13-
RUN adduser -u 9000 -D app
1414
COPY . /usr/src/app
15-
RUN chown -R app:app /usr/src/app
15+
RUN chown -R app:app .
1616

1717
USER app
1818

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ image:
66
docker build --rm -t $(IMAGE_NAME) .
77

88
test: image
9-
docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && bundle exec rake"
9+
docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && bundle install --with=test && bundle exec rake"
1010

1111
docs: image
1212
docker run --rm \
1313
--user root \
1414
--workdir /usr/src/app \
1515
--volume $(PWD):/usr/src/app \
16-
$(IMAGE_NAME) sh -c "bundle exec rake docs:scrape"
16+
$(IMAGE_NAME) sh -c "apk --update add git && bundle exec rake docs:scrape"

Rakefile

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# frozen_string_literal: true
22

3-
require "rspec/core/rake_task"
4-
53
Rake.add_rakelib "lib/tasks"
6-
RSpec::Core::RakeTask.new(:spec)
7-
task default: :spec
4+
5+
begin
6+
require "rspec/core/rake_task"
7+
8+
RSpec::Core::RakeTask.new(:spec)
9+
task default: :spec
10+
rescue LoadError
11+
end

0 commit comments

Comments
 (0)