From a0b746b5367beda9b6599f0eba872bf84f398214 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Tue, 17 Dec 2024 14:52:42 +0800 Subject: [PATCH] Move nginx installation into another build step Avoids polluting the main image with nginx's build dependencies --- image/base/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/image/base/Dockerfile b/image/base/Dockerfile index 1818b8fc1..8fdb0f2b6 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -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 @@ -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