@@ -52,17 +52,18 @@ COPY --from=docs/docker.github.io:nginx-onbuild /etc/nginx/conf.d/default.conf /
52
52
CMD echo -e "Docker docs are viewable at:\n http://0.0.0.0:4000" ; exec nginx -g 'daemon off;'
53
53
54
54
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
+
66
67
67
68
# Fetch upstream resources (reference documentation)
68
69
# Only add the files that are needed to build these reference docs, so that
@@ -74,20 +75,16 @@ COPY ./_data/toc.yaml ./_data/
74
75
RUN bash ./_scripts/fetch-upstream-resources.sh .
75
76
76
77
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
78
80
FROM builderbase AS current
79
81
COPY . .
80
82
COPY --from=upstream-resources /usr/src/app/md_source/. ./
81
-
82
- # Build the static HTML, now that everything is in place
83
83
RUN jekyll build -d ${TARGET}
84
-
85
- # Fix up some links, don't touch the archives
86
84
RUN 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
87
85
88
86
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