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 <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2020-02-28 13:50:07 +01:00
parent 40e5ab6009
commit ab9fe6e98e
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 6 additions and 10 deletions

View File

@ -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;'