Skip to content

Commit a0b746b

Browse files
committed
Move nginx installation into another build step
Avoids polluting the main image with nginx's build dependencies
1 parent 5ed07ec commit a0b746b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

image/base/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ FROM builder AS imagemagick_builder
1717
ADD install-imagemagick /tmp/install-imagemagick
1818
RUN /tmp/install-imagemagick
1919

20+
FROM builder AS nginx_builder
21+
ADD nginx_public_keys.key /tmp/nginx_public_keys.key
22+
ADD install-nginx /tmp/install-nginx
23+
RUN gpg --import /tmp/nginx_public_keys.key &&\
24+
rm /tmp/nginx_public_keys.key &&\
25+
/tmp/install-nginx
26+
2027
FROM discourse/ruby:3.3.6-${DEBIAN_RELEASE}-slim AS discourse_dependencies
2128

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

101+
COPY --from=nginx_builder /usr/share/nginx/sbin/nginx /usr/sbin
102+
94103
# Copy binary and configuration files for magick
95104
COPY --from=imagemagick_builder /usr/local/bin/magick /usr/local/bin/magick
96105
COPY --from=imagemagick_builder /usr/local/etc/ImageMagick-7 /usr/local/etc/ImageMagick-7

0 commit comments

Comments
 (0)