lib/generators/templates/Dockerfile.erb in dockerfile-rails-1.2.3 vs lib/generators/templates/Dockerfile.erb in dockerfile-rails-1.2.4
- old
+ new
@@ -30,14 +30,11 @@
# Set production environment
ENV <%= base_env.join(" \\\n ") %>
# Update gems and bundler
RUN gem update --system --no-document && \
-<% if options.ci? and options.lock? -%>
- gem install -N irb reline && \
-<% end -%>
- gem install -N bundler
+ gem install -N <%= base_gems.join(" ") %>
<% unless base_requirements.empty? -%>
# Install packages needed to install <%= base_requirements %>
<%= render partial: 'apt_install', locals: {packages: base_packages, clean: true, repos: ''} %>
@@ -80,11 +77,11 @@
# Build options
ENV <%= build_env.join(" \\\n ") %>
<% end -%>
# Install application gems
-COPY Gemfile Gemfile.lock .
+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 \
bundle config set app_config .bundle && \
bundle config set path /srv/vendor && \
bundle install && \
@@ -96,11 +93,12 @@
bundle config set path vendor && \
cp -ar /srv/vendor .
<% else -%>
RUN bundle install<% if depend_on_bootsnap? -%> && \
- bundle exec bootsnap precompile --gemfile<% end %>
+ bundle exec bootsnap precompile --gemfile<% end %> && \
+ rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git
<% end -%>
<% if parallel? -%>
# Copy node modules
COPY --from=node /rails/node_modules /rails/node_modules
@@ -108,11 +106,11 @@
<% elsif using_node? -%>
<%= render partial: 'npm_install', locals: {sources: Dir[*%w(package.json package-lock.json yarn.lock)]} %>
<% end -%>
# Copy application code
-COPY . .
+COPY<% if options.link? %> --link<% end %> . .
<% if depend_on_bootsnap? -%>
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
@@ -159,10 +157,10 @@
<% if options.compose? -%>
ARG UID=1000 \
GID=1000
RUN groupadd -f -g $GID rails && \
useradd -u $UID -g $GID rails<% else -%>
-RUN useradd rails<% end -%><% if options.nginx? %> && \
+RUN useradd rails<% end -%> --home /rails --shell /bin/bash<% if options.nginx? %> && \
chown rails:rails /var/lib/nginx /var/log/nginx/*<% end %>
<% unless options.swap -%>
USER rails:rails
<% end -%>