lib/generators/templates/Dockerfile.erb in dockerfile-rails-1.5.3 vs lib/generators/templates/Dockerfile.erb in dockerfile-rails-1.5.4

- old
+ new

@@ -84,24 +84,37 @@ <% end -%> # Install application gems COPY<% if options.link? %> --link<% end %> Gemfile Gemfile.lock ./ <% if options.cache? -%> RUN --mount=type=cache,id=bld-gem-cache,sharing=locked,target=/srv/vendor \ +<% if private_gemserver_env_variable_name -%> + --mount=type=secret,id=gemserver_credentials,dst=/kaniko/gemserver_credentials \ + <%= private_gemserver_env_variable_name %>="$(cat /kaniko/gemserver_credentials)" && \ + export <%= private_gemserver_env_variable_name %> && \ +<% end -%> bundle config set app_config .bundle && \ bundle config set path /srv/vendor && \ bundle install && \ -<% if depend_on_bootsnap? -%> +<% if depend_on_bootsnap? && options.precompile != "defer" -%> bundle exec bootsnap precompile --gemfile && \ <% end -%> bundle clean && \ mkdir -p vendor && \ bundle config set path vendor && \ cp -ar /srv/vendor . <% else -%> -RUN bundle install<% if depend_on_bootsnap? -%> && \ +<% if private_gemserver_env_variable_name -%> +RUN --mount=type=secret,id=gemserver_credentials,dst=/kaniko/gemserver_credentials \ + <%= private_gemserver_env_variable_name %>="$(cat /kaniko/gemserver_credentials)" && \ + export <%= private_gemserver_env_variable_name %> && \ + bundle install<% if depend_on_bootsnap? && options.precompile != "defer" -%> && \ bundle exec bootsnap precompile --gemfile<% end %> && \ +<% else -%> +RUN bundle install<% if depend_on_bootsnap? && options.precompile != "defer" -%> && \ + bundle exec bootsnap precompile --gemfile<% end %> && \ +<% end -%> rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git <% end -%> <% if using_passenger? -%> # Compile passenger native support @@ -113,10 +126,10 @@ COPY --from=node /rails/node_modules /rails/node_modules COPY --from=node /usr/local/node /usr/local/node ENV PATH=/usr/local/node/bin:$PATH <% elsif using_node? -%> -<%= render partial: 'npm_install', locals: {sources: Dir[*%w(package.json package-lock.json yarn.lock)]} %> +<%= render partial: 'npm_install', locals: {sources: Dir[*%w(.npmrc .yarnrc package.json package-lock.json yarn.lock)]} %> <% end -%> # Copy application code COPY<% if options.link? %> --link<% end %> . .