Skip to content

Commit

Permalink
Move nginx installation into another build step
Browse files Browse the repository at this point in the history
Avoids polluting the main image with nginx's build dependencies
  • Loading branch information
tgxworld committed Dec 17, 2024
1 parent 5ed07ec commit a0b746b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions image/base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ FROM builder AS imagemagick_builder
ADD install-imagemagick /tmp/install-imagemagick
RUN /tmp/install-imagemagick

FROM builder AS nginx_builder
ADD nginx_public_keys.key /tmp/nginx_public_keys.key
ADD install-nginx /tmp/install-nginx
RUN gpg --import /tmp/nginx_public_keys.key &&\
rm /tmp/nginx_public_keys.key &&\
/tmp/install-nginx

FROM discourse/ruby:3.3.6-${DEBIAN_RELEASE}-slim AS discourse_dependencies

ARG DEBIAN_RELEASE
Expand Down Expand Up @@ -91,6 +98,8 @@ RUN sed -i "s/^# $LANG/$LANG/" /etc/locale.gen; \
RUN --mount=type=tmpfs,target=/root/.npm \
npm install -g terser uglify-js pnpm

COPY --from=nginx_builder /usr/share/nginx/sbin/nginx /usr/sbin

# Copy binary and configuration files for magick
COPY --from=imagemagick_builder /usr/local/bin/magick /usr/local/bin/magick
COPY --from=imagemagick_builder /usr/local/etc/ImageMagick-7 /usr/local/etc/ImageMagick-7
Expand Down

0 comments on commit a0b746b

Please sign in to comment.