Skip to content

Commit 6bb85ca

Browse files
authored
Merge pull request rails#47479 from Shopify/docker-tweak-bundle-install
Dockerfile: Improve bundle install
2 parents a124668 + 85bab70 commit 6bb85ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

railties/lib/rails/generators/rails/app/templates/Dockerfile.tt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ WORKDIR /rails
99

1010
# Set production environment
1111
ENV RAILS_ENV="production" \
12+
BUNDLE_DEPLOYMENT="1" \
13+
BUNDLE_PATH="/usr/local/bundle" \
1214
BUNDLE_WITHOUT="development"
1315

1416

@@ -33,7 +35,8 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
3335
<% end -%>
3436
# Install application gems
3537
COPY Gemfile Gemfile.lock ./
36-
RUN bundle install<% if depend_on_bootsnap? -%> && \
38+
RUN bundle install && \
39+
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git<% if depend_on_bootsnap? -%> && \
3740
bundle exec bootsnap precompile --gemfile
3841
<% end %>
3942

0 commit comments

Comments
 (0)