Skip to content

Commit 81f56da

Browse files
committedOct 21, 2018
Reduce Docker image size from 906 to 769 MB
- use updated Phusion Ruby image so that Ruby gems won't need to be updated during Docker build - clean Bundler and Ruby gems caches after installing dependencies - copy with correct ownership instead of chown-ing after copying See also #52
1 parent 5b0ebca commit 81f56da

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed
 

Diff for: ‎Dockerfile

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
# ubuntu:14.04 -- https://hub.docker.com/_/ubuntu/
1+
# ubuntu:16.04 -- https://hub.docker.com/_/ubuntu/
22
# |==> phusion/baseimage:0.9.17 -- https://goo.gl/ZLt61q
3-
# |==> phusion/passenger-ruby22:0.9.17 -- https://goo.gl/xsnWOP
3+
# |==> phusion/passenger-docker -- https://goo.gl/xsnWOP
44
# |==> HERE
5-
FROM phusion/passenger-ruby24:0.9.26
5+
FROM phusion/passenger-ruby24:0.9.35
66

77
ENV APP_HOME=/home/app/pact_broker/
88
RUN rm -f /etc/service/nginx/down /etc/nginx/sites-enabled/default
99
COPY container /
10-
RUN gem update --system
11-
# USER app
10+
#USER app
1211

13-
COPY pact_broker/config.ru pact_broker/Gemfile pact_broker/Gemfile.lock $APP_HOME
14-
# Update system gems for:
15-
# https://www.ruby-lang.org/en/news/2017/08/29/multiple-vulnerabilities-in-rubygems/
16-
RUN gem install bundler && \
17-
cd $APP_HOME && bundle install --deployment --without='development test'
18-
COPY pact_broker/ $APP_HOME/
19-
RUN chown -R app:app $APP_HOME
12+
COPY --chown=app pact_broker/ $APP_HOME/
13+
RUN cd $APP_HOME && \
14+
gem install --no-document --minimal-deps bundler && \
15+
bundle install --deployment --without='development test' && \
16+
rm -rf vendor/bundle/ruby/2.4.0/cache/ /usr/local/rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/cache
2017

2118
EXPOSE 80
2219
CMD ["/sbin/my_init"]

0 commit comments

Comments
 (0)