From ab9fe6e98e83ec21a2168075a38ccef6dc2f6fff Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 28 Feb 2020 13:50:07 +0100 Subject: [PATCH] Dockerfile: remove "deploybase" stage, and inline instead The "deploybase" stage was only used for the final stage. This patch inlines the steps from that stage to the final stage itself. In the process, changing the order of copying the NGINX configuration file to _after_ the docs were copied. This prevents having to copy the archived docs when making a change in the NGINX configuration. The NGINX configuration file _will_ now be copied on each rebuild, but the file is small, and as such is still faster than copying all archives. Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4b02c628ad..754180b8fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,15 +39,6 @@ ARG DISTRIBUTION_BRANCH ENV DISTRIBUTION_BRANCH=${DISTRIBUTION_BRANCH} -# Base stage to be used for deploying the docs -FROM nginx:alpine AS deploybase -ENV TARGET=/usr/share/nginx/html -COPY _deploy/nginx/default.conf /etc/nginx/conf.d/default.conf - -# Set the default command to serve the static HTML site -CMD echo -e "Docker docs are viewable at:\nhttp://0.0.0.0:4000"; exec nginx -g 'daemon off;' - - # Empty stage if archives are disabled (ENABLE_ARCHIVES=false) FROM scratch AS archives-false @@ -108,8 +99,13 @@ COPY --from=current /usr/share/nginx/html / # # To build without archives: # DOCKER_BUILDKIT=1 docker build -t docs --build-arg ENABLE_ARCHIVES=false . -FROM deploybase AS deploy +FROM nginx:alpine AS deploy +ENV TARGET=/usr/share/nginx/html WORKDIR $TARGET COPY --from=archives / . COPY --from=current /usr/share/nginx/html . + +# Configure NGINX +COPY _deploy/nginx/default.conf /etc/nginx/conf.d/default.conf +CMD echo -e "Docker docs are viewable at:\nhttp://0.0.0.0:4000"; exec nginx -g 'daemon off;'