Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/generators/templates/_apt_install.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
RUN <%= pkg_cache.map {|name, path| "--mount=type=cache,id=#{name},sharing=locked,target=#{path} \\"}.join("\n ") %>
<%= repos %><%= pkg_update %> && \
<%= pkg_install %> <%= packages.join(" ") %>
<% elsif options.alpine? && clean -%>
RUN apk add --no-cache <%= packages.join(" ") %>
<% else -%>
RUN <%= repos %><%= pkg_update %> && \
<%= pkg_install %> <%= packages.join(" ") %><% if clean %> && \
Expand Down
12 changes: 3 additions & 9 deletions test/results/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ RUN gem update --system --no-document && \
gem install -N bundler

# Install base packages
RUN apk update && \
apk add curl jemalloc postgresql-client tzdata && \
rm -rf /var/cache/apk/*
RUN apk add --no-cache curl jemalloc postgresql-client tzdata

# Set production environment
ENV BUNDLE_DEPLOYMENT="1" \
Expand All @@ -34,9 +32,7 @@ ENV BUNDLE_DEPLOYMENT="1" \
FROM base AS build

# Install packages needed to build gems and node modules
RUN apk update && \
apk add build-base gyp libpq-dev pkgconfig python3 yaml-dev && \
rm -rf /var/cache/apk/*
RUN apk add --no-cache build-base gyp libpq-dev pkgconfig python3 yaml-dev

# Install JavaScript dependencies
ARG NODE_VERSION=xxx
Expand Down Expand Up @@ -72,9 +68,7 @@ RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
FROM base

# Install packages needed for deployment
RUN apk update && \
apk add libpq && \
rm -rf /var/cache/apk/*
RUN apk add --no-cache libpq

# Copy built artifacts: gems, application
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
Expand Down
Loading