Skip to content

Commit 658c989

Browse files
committed
speed up docker build
1 parent ce96809 commit 658c989

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,15 @@ RUN rm -rf node_modules
103103
# Final stage for app image
104104
FROM base
105105

106-
# Copy built artifacts: gems, application
107-
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
108-
COPY --from=build /rails /rails
109-
110106
# Run and own only the runtime files as a non-root user for security
111107
RUN groupadd --system --gid 1000 rails && \
112-
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
113-
chown -R rails:rails <%= dockerfile_chown_directories.join(" ") %>
108+
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
114109
USER 1000:1000
115110

111+
# Copy built artifacts: gems, application
112+
COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
113+
COPY --chown=rails:rails --from=build /rails /rails
114+
116115
# Entrypoint prepares the database.
117116
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
118117

0 commit comments

Comments
 (0)