lib/generators/templates/Dockerfile.erb in dockerfile-rails-1.2.1 vs lib/generators/templates/Dockerfile.erb in dockerfile-rails-1.2.2

- old
+ new

@@ -28,17 +28,16 @@ <% end -%> # Set production environment ENV <%= base_env.join(" \\\n ") %> -# Update gems and preinstall the desired version of bundler -ARG BUNDLER_VERSION=<%= Bundler::VERSION %> +# Update gems and bundler RUN gem update --system --no-document && \ <% if options.ci? -%> gem install -N irb reline && \ <% end -%> - gem install -N bundler -v ${BUNDLER_VERSION} + gem install -N bundler <% unless base_requirements.empty? -%> # Install packages needed to install <%= base_requirements %> <%= render partial: 'apt_install', locals: {packages: base_packages, clean: true, repos: ''} %> @@ -81,26 +80,26 @@ # Build options ENV <%= build_env.join(" \\\n ") %> <% end -%> # Install application gems -COPY Gemfile Gemfile.lock ./ +COPY Gemfile Gemfile.lock . <% if options.cache? -%> RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \ bundle config set app_config .bundle && \ bundle config set path /srv/vendor && \ - bundle _${BUNDLER_VERSION}_ install && \ + bundle install && \ <% if depend_on_bootsnap? -%> bundle exec bootsnap precompile --gemfile && \ <% end -%> bundle clean && \ mkdir -p vendor && \ bundle config set path vendor && \ cp -ar /srv/vendor . <% else -%> -RUN bundle _${BUNDLER_VERSION}_ install<% if depend_on_bootsnap? -%> && \ +RUN bundle install<% if depend_on_bootsnap? -%> && \ bundle exec bootsnap precompile --gemfile<% end %> <% end -%> <% if parallel? -%> # Copy node modules @@ -168,10 +167,11 @@ USER rails:rails <% end -%> <% end -%> <% unless options.precompile == "defer" -%> -# Copy built application from previous stage +# Copy built artifacts: gems, application +COPY --from=build /usr/local/bundle /usr/local/bundle COPY --from=build <% unless run_as_root? %>--chown=rails:rails <% end %>/rails /rails <% if api_client_dir -%> # Copy built client COPY --from=client <% unless run_as_root? %>--chown=rails:rails <% end %>/rails/<%= api_client_dir %>/build /rails/public