@@ -18,6 +18,8 @@ ARG ENGINE_BRANCH="19.03.x"
18
18
# Distribution
19
19
ARG DISTRIBUTION_BRANCH="release/2.7"
20
20
21
+ # Set to "false" to build the documentation without archives
22
+ ARG ENABLE_ARCHIVES=true
21
23
22
24
# ##
23
25
# Set up base stages for building and deploying
@@ -52,8 +54,11 @@ COPY --from=docs/docker.github.io:nginx-onbuild /etc/nginx/conf.d/default.conf /
52
54
CMD echo -e "Docker docs are viewable at:\n http://0.0.0.0:4000" ; exec nginx -g 'daemon off;'
53
55
54
56
55
- # Stage with static HTML for all archives
56
- FROM scratch AS archives
57
+ # Empty stage if archives are disabled (ENABLE_ARCHIVES=false)
58
+ FROM scratch AS archives-false
59
+
60
+ # Stage with static HTML for all archives (ENABLE_ARCHIVES=true)
61
+ FROM scratch AS archives-true
57
62
ENV TARGET=/usr/share/nginx/html
58
63
# To add a new archive, add it here and ALSO edit _data/docsarchive/archives.yaml
59
64
# to add it to the drop-down
@@ -64,6 +69,8 @@ COPY --from=docs/docker.github.io:v17.12 ${TARGET} /
64
69
COPY --from=docs/docker.github.io:v18.03 ${TARGET} /
65
70
COPY --from=docs/docker.github.io:v18.09 ${TARGET} /
66
71
72
+ # Stage either with, or without archives, depending on ENABLE_ARCHIVES
73
+ FROM archives-${ENABLE_ARCHIVES} AS archives
67
74
68
75
# Fetch upstream resources (reference documentation)
69
76
# Only add the files that are needed to build these reference docs, so that
@@ -84,7 +91,15 @@ RUN jekyll build -d ${TARGET}
84
91
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
85
92
86
93
87
- # Final stage, which includes nginx, current docs, and archived versions
94
+ # Final stage, which includes nginx, and, depending on ENABLE_ARCHIVES, either
95
+ # current docs and archived versions (ENABLE_ARCHIVES=true), or only the current
96
+ # docs (ENABLE_ARCHIVES=false).
97
+ #
98
+ # To build current docs, including archives:
99
+ # DOCKER_BUILDKIT=1 docker build -t docs .
100
+ #
101
+ # To build without archives:
102
+ # DOCKER_BUILDKIT=1 docker build -t docs --build-arg ENABLE_ARCHIVES=false .
88
103
FROM deploybase AS deploy
89
104
COPY --from=archives / ${TARGET}
90
105
COPY --from=current ${TARGET} ${TARGET}
0 commit comments