File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
railties/lib/rails/generators/rails/app/templates Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ WORKDIR /rails
12
12
13
13
# Install base packages
14
14
RUN apt-get update -qq && \
15
- apt-get install --no-install-recommends -y <%= dockerfile_base_packages.join(" ") %>
15
+ apt-get install --no-install-recommends -y <%= dockerfile_base_packages.join(" ") %> && \
16
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
16
17
17
18
# Set production environment
18
19
ENV RAILS_ENV="production" \
@@ -24,7 +25,9 @@ ENV RAILS_ENV="production" \
24
25
FROM base as build
25
26
26
27
# Install packages needed to build gems<%= using_node? ? " and node modules" : "" %>
27
- RUN apt-get install --no-install-recommends -y <%= dockerfile_build_packages.join(" ") %>
28
+ RUN apt-get update -qq && \
29
+ apt-get install --no-install-recommends -y <%= dockerfile_build_packages.join(" ") %> && \
30
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
28
31
29
32
<% if using_node? -%>
30
33
# Install JavaScript dependencies
@@ -88,9 +91,6 @@ RUN rm -rf node_modules
88
91
# Final stage for app image
89
92
FROM base
90
93
91
- # Clean up installation packages to reduce image size
92
- RUN rm -rf /var/lib/apt/lists /var/cache/apt/archives
93
-
94
94
# Copy built artifacts: gems, application
95
95
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
96
96
COPY --from=build /rails /rails
You can’t perform that action at this time.
0 commit comments