@@ -52,17 +52,18 @@ COPY --from=docs/docker.github.io:nginx-onbuild /etc/nginx/conf.d/default.conf /
5252CMD echo -e "Docker docs are viewable at:\n http://0.0.0.0:4000" ; exec nginx -g 'daemon off;'
5353
5454
55- # Build the archived docs
56- # these docs barely change, so can be cached
57- FROM deploybase AS archives
58- # Get all the archive static HTML and put it into place. To add a new archive,
59- # add it here, and ALSO edit _data/docsarchives/archives.yaml to add it to the drop-down
60- COPY --from=docs/docker.github.io:v17.03 ${TARGET} ${TARGET}
61- COPY --from=docs/docker.github.io:v17.06 ${TARGET} ${TARGET}
62- COPY --from=docs/docker.github.io:v17.09 ${TARGET} ${TARGET}
63- COPY --from=docs/docker.github.io:v17.12 ${TARGET} ${TARGET}
64- COPY --from=docs/docker.github.io:v18.03 ${TARGET} ${TARGET}
65- COPY --from=docs/docker.github.io:v18.09 ${TARGET} ${TARGET}
55+ # Stage with static HTML for all archives
56+ FROM scratch AS archives
57+ ENV TARGET=/usr/share/nginx/html
58+ # To add a new archive, add it here and ALSO edit _data/docsarchive/archives.yaml
59+ # to add it to the drop-down
60+ COPY --from=docs/docker.github.io:v17.03 ${TARGET} /
61+ COPY --from=docs/docker.github.io:v17.06 ${TARGET} /
62+ COPY --from=docs/docker.github.io:v17.09 ${TARGET} /
63+ COPY --from=docs/docker.github.io:v17.12 ${TARGET} /
64+ COPY --from=docs/docker.github.io:v18.03 ${TARGET} /
65+ COPY --from=docs/docker.github.io:v18.09 ${TARGET} /
66+
6667
6768# Fetch upstream resources (reference documentation)
6869# Only add the files that are needed to build these reference docs, so that
@@ -74,20 +75,16 @@ COPY ./_data/toc.yaml ./_data/
7475RUN bash ./_scripts/fetch-upstream-resources.sh .
7576
7677
77- # Build the current docs from the checked out branch
78+ # Build the static HTML for the current docs.
79+ # After building with jekyll, fix up some links, but don't touch the archives
7880FROM builderbase AS current
7981COPY . .
8082COPY --from=upstream-resources /usr/src/app/md_source/. ./
81-
82- # Build the static HTML, now that everything is in place
8383RUN jekyll build -d ${TARGET}
84-
85- # Fix up some links, don't touch the archives
8684RUN find ${TARGET} -type f -name '*.html' | grep -vE "v[0-9]+\. " | while read i; do sed -i 's#href="https://docs.docker.com/#href="/#g' "$i" ; done
8785
8886
89- # Docs with archives (for deploy)
90- FROM archives AS deploy
91-
92- # Add the current version of the docs
93- COPY --from=current ${TARGET} ${TARGET}
87+ # Final stage, which includes nginx, current docs, and archived versions
88+ FROM deploybase AS deploy
89+ COPY --from=archives / ${TARGET}
90+ COPY --from=current ${TARGET} ${TARGET}
0 commit comments