From c7b9a54df97c040ad7990221d8f096b6d577fd88 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 7 Mar 2019 15:15:13 +0100 Subject: [PATCH 1/5] Dockerfile: fix missing "boilerplate.txt" in build-stage Although the docs still rendered ok, some pieces were missing when generating the "samples", which resulted in warnings during build: ``` Adding front-matter to ./_samples/library/rethinkdb/README.md ... cat: can't open './_samples/boilerplate.txt': No such file or directory Adding front-matter to ./_samples/library/tomcat/README.md ... cat: can't open './_samples/boilerplate.txt': No such file or directory ``` Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 7e446d4a8e..2f42486c19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -70,6 +70,7 @@ FROM builderbase AS upstream-resources COPY ./_scripts/fetch-upstream-resources.sh ./_scripts/ COPY ./_config.yml . COPY ./_data/toc.yaml ./_data/ +COPY ./_samples/boilerplate.txt ./_samples/ RUN bash ./_scripts/fetch-upstream-resources.sh . From 0785a8513e2450f6e2cc5076eb61e7b2e48efaa7 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 7 Mar 2019 15:17:17 +0100 Subject: [PATCH 2/5] Make wget less noisy when fetching upstream resources Add a `--quiet` flag to suppress progress output; ``` --2019-03-07 14:02:43-- https://raw.githubusercontent.com/docker/docker-ce/17.12/components/engine/api/swagger.yaml Resolving raw.githubusercontent.com... 151.101.0.133, 151.101.64.133, 151.101.128.133, ... Connecting to raw.githubusercontent.com|151.101.0.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 343126 (335K) [text/plain] Saving to: './engine/api/v1.35/swagger.yaml' 0K .......... .......... .......... .......... .......... 14% 2.97M 0s 50K .......... .......... .......... .......... .......... 29% 6.10M 0s 100K .......... .......... .......... .......... .......... 44% 6.22M 0s 150K .......... .......... .......... .......... .......... 59% 6.32M 0s 200K .......... .......... .......... .......... .......... 74% 6.15M 0s 250K .......... .......... .......... .......... .......... 89% 6.11M 0s 300K .......... .......... .......... ..... 100% 6.82M=0.06s 2019-03-07 14:02:44 (5.37 MB/s) - './engine/api/v1.35/swagger.yaml' saved [343126/343126] ``` Signed-off-by: Sebastiaan van Stijn --- _scripts/fetch-upstream-resources.sh | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/_scripts/fetch-upstream-resources.sh b/_scripts/fetch-upstream-resources.sh index 5e2a8761b1..9033ce3963 100755 --- a/_scripts/fetch-upstream-resources.sh +++ b/_scripts/fetch-upstream-resources.sh @@ -113,34 +113,34 @@ done # Be careful with the locations on Github for these # When you change this you need to make sure to copy the previous # directory into a new one in the docs git and change the index.html -wget --directory-prefix=./engine/api/v1.25/ https://raw.githubusercontent.com/docker/docker/v1.13.0/api/swagger.yaml || (echo "Failed 1.25 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.26/ https://raw.githubusercontent.com/docker/docker/v17.03.0-ce/api/swagger.yaml || (echo "Failed 1.26 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.27/ https://raw.githubusercontent.com/docker/docker/v17.03.1-ce/api/swagger.yaml || (echo "Failed 1.27 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.28/ https://raw.githubusercontent.com/docker/docker/v17.04.0-ce/api/swagger.yaml || (echo "Failed 1.28 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.29/ https://raw.githubusercontent.com/docker/docker/17.05.x/api/swagger.yaml || (echo "Failed 1.29 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.25/ https://raw.githubusercontent.com/docker/docker/v1.13.0/api/swagger.yaml || (echo "Failed 1.25 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.26/ https://raw.githubusercontent.com/docker/docker/v17.03.0-ce/api/swagger.yaml || (echo "Failed 1.26 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.27/ https://raw.githubusercontent.com/docker/docker/v17.03.1-ce/api/swagger.yaml || (echo "Failed 1.27 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.28/ https://raw.githubusercontent.com/docker/docker/v17.04.0-ce/api/swagger.yaml || (echo "Failed 1.28 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.29/ https://raw.githubusercontent.com/docker/docker/17.05.x/api/swagger.yaml || (echo "Failed 1.29 swagger download" && exit 1) # New location for swagger.yaml for 17.06+ -wget --directory-prefix=./engine/api/v1.30/ https://raw.githubusercontent.com/docker/docker-ce/17.06/components/engine/api/swagger.yaml || (echo "Failed 1.30 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.31/ https://raw.githubusercontent.com/docker/docker-ce/17.07/components/engine/api/swagger.yaml || (echo "Failed 1.31 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.32/ https://raw.githubusercontent.com/docker/docker-ce/17.09/components/engine/api/swagger.yaml || (echo "Failed 1.32 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.33/ https://raw.githubusercontent.com/docker/docker-ce/17.10/components/engine/api/swagger.yaml || (echo "Failed 1.33 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.34/ https://raw.githubusercontent.com/docker/docker-ce/17.11/components/engine/api/swagger.yaml || (echo "Failed 1.34 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.35/ https://raw.githubusercontent.com/docker/docker-ce/17.12/components/engine/api/swagger.yaml || (echo "Failed 1.35 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.36/ https://raw.githubusercontent.com/docker/docker-ce/18.02/components/engine/api/swagger.yaml || (echo "Failed 1.36 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.37/ https://raw.githubusercontent.com/docker/docker-ce/18.03/components/engine/api/swagger.yaml || (echo "Failed 1.37 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.38/ https://raw.githubusercontent.com/docker/docker-ce/18.06/components/engine/api/swagger.yaml || (echo "Failed 1.38 swagger download" && exit 1) -wget --directory-prefix=./engine/api/v1.39/ https://raw.githubusercontent.com/docker/docker-ce/18.09/components/engine/api/swagger.yaml || (echo "Failed 1.39 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.30/ https://raw.githubusercontent.com/docker/docker-ce/17.06/components/engine/api/swagger.yaml || (echo "Failed 1.30 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.31/ https://raw.githubusercontent.com/docker/docker-ce/17.07/components/engine/api/swagger.yaml || (echo "Failed 1.31 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.32/ https://raw.githubusercontent.com/docker/docker-ce/17.09/components/engine/api/swagger.yaml || (echo "Failed 1.32 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.33/ https://raw.githubusercontent.com/docker/docker-ce/17.10/components/engine/api/swagger.yaml || (echo "Failed 1.33 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.34/ https://raw.githubusercontent.com/docker/docker-ce/17.11/components/engine/api/swagger.yaml || (echo "Failed 1.34 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.35/ https://raw.githubusercontent.com/docker/docker-ce/17.12/components/engine/api/swagger.yaml || (echo "Failed 1.35 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.36/ https://raw.githubusercontent.com/docker/docker-ce/18.02/components/engine/api/swagger.yaml || (echo "Failed 1.36 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.37/ https://raw.githubusercontent.com/docker/docker-ce/18.03/components/engine/api/swagger.yaml || (echo "Failed 1.37 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.38/ https://raw.githubusercontent.com/docker/docker-ce/18.06/components/engine/api/swagger.yaml || (echo "Failed 1.38 swagger download" && exit 1) +wget --quiet --directory-prefix=./engine/api/v1.39/ https://raw.githubusercontent.com/docker/docker-ce/18.09/components/engine/api/swagger.yaml || (echo "Failed 1.39 swagger download" && exit 1) # Get dockerd.md from upstream -wget --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/dockerd.md || (echo "Failed to fetch stable dockerd.md" && exit 1) +wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/dockerd.md || (echo "Failed to fetch stable dockerd.md" && exit 1) # Get a few one-off files that we use directly from upstream -wget --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/builder.md || (echo "Failed engine/reference/builder.md download" && exit 1) -wget --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/builder.md || (echo "Failed engine/reference/builder.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) # Adjust this one when Edge != Stable -wget --directory-prefix=./edge/engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) -wget --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/cli.md || (echo "Failed engine/reference/commandline/cli.md download" && exit 1) -wget --directory-prefix=./engine/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/deprecated.md || (echo "Failed engine/deprecated.md download" && exit 1) -wget --directory-prefix=./registry/ https://raw.githubusercontent.com/docker/distribution/"$DISTRIBUTION_BRANCH"/docs/configuration.md || (echo "Failed registry/configuration.md download" && exit 1) +wget --quiet --directory-prefix=./edge/engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/cli.md || (echo "Failed engine/reference/commandline/cli.md download" && exit 1) +wget --quiet --directory-prefix=./engine/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/deprecated.md || (echo "Failed engine/deprecated.md download" && exit 1) +wget --quiet --directory-prefix=./registry/ https://raw.githubusercontent.com/docker/distribution/"$DISTRIBUTION_BRANCH"/docs/configuration.md || (echo "Failed registry/configuration.md download" && exit 1) # Remove things we don't want in the build rm ./registry/spec/api.md.tmpl From f297c554b6043d95002793c8b09b00dc93602654 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 7 Mar 2019 15:29:06 +0100 Subject: [PATCH 3/5] Remove remaining "edge" docs Signed-off-by: Sebastiaan van Stijn --- _scripts/fetch-upstream-resources.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/_scripts/fetch-upstream-resources.sh b/_scripts/fetch-upstream-resources.sh index 9033ce3963..c72b10d5a4 100755 --- a/_scripts/fetch-upstream-resources.sh +++ b/_scripts/fetch-upstream-resources.sh @@ -136,8 +136,6 @@ wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.gith # Get a few one-off files that we use directly from upstream wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/builder.md || (echo "Failed engine/reference/builder.md download" && exit 1) wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) -# Adjust this one when Edge != Stable -wget --quiet --directory-prefix=./edge/engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/cli.md || (echo "Failed engine/reference/commandline/cli.md download" && exit 1) wget --quiet --directory-prefix=./engine/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/deprecated.md || (echo "Failed engine/deprecated.md download" && exit 1) wget --quiet --directory-prefix=./registry/ https://raw.githubusercontent.com/docker/distribution/"$DISTRIBUTION_BRANCH"/docs/configuration.md || (echo "Failed registry/configuration.md download" && exit 1) From d2504d31dc9d20a211c23803ffcfb23ebbcbcaad Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 7 Mar 2019 15:31:51 +0100 Subject: [PATCH 4/5] Reorder fetching of upstream-resources Signed-off-by: Sebastiaan van Stijn --- _scripts/fetch-upstream-resources.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/_scripts/fetch-upstream-resources.sh b/_scripts/fetch-upstream-resources.sh index c72b10d5a4..344b5576b9 100755 --- a/_scripts/fetch-upstream-resources.sh +++ b/_scripts/fetch-upstream-resources.sh @@ -130,15 +130,14 @@ wget --quiet --directory-prefix=./engine/api/v1.37/ https://raw.githubuserconten wget --quiet --directory-prefix=./engine/api/v1.38/ https://raw.githubusercontent.com/docker/docker-ce/18.06/components/engine/api/swagger.yaml || (echo "Failed 1.38 swagger download" && exit 1) wget --quiet --directory-prefix=./engine/api/v1.39/ https://raw.githubusercontent.com/docker/docker-ce/18.09/components/engine/api/swagger.yaml || (echo "Failed 1.39 swagger download" && exit 1) -# Get dockerd.md from upstream -wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/dockerd.md || (echo "Failed to fetch stable dockerd.md" && exit 1) # Get a few one-off files that we use directly from upstream -wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/builder.md || (echo "Failed engine/reference/builder.md download" && exit 1) -wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) -wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/cli.md || (echo "Failed engine/reference/commandline/cli.md download" && exit 1) -wget --quiet --directory-prefix=./engine/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/deprecated.md || (echo "Failed engine/deprecated.md download" && exit 1) -wget --quiet --directory-prefix=./registry/ https://raw.githubusercontent.com/docker/distribution/"$DISTRIBUTION_BRANCH"/docs/configuration.md || (echo "Failed registry/configuration.md download" && exit 1) +wget --quiet --directory-prefix=./engine/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/deprecated.md || (echo "Failed engine/deprecated.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/builder.md || (echo "Failed engine/reference/builder.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/run.md || (echo "Failed engine/reference/run.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/cli.md || (echo "Failed engine/reference/commandline/cli.md download" && exit 1) +wget --quiet --directory-prefix=./engine/reference/commandline/ https://raw.githubusercontent.com/docker/docker-ce/"$ENGINE_BRANCH"/components/cli/docs/reference/commandline/dockerd.md || (echo "Failed engine/reference/commandline/dockerd.md download" && exit 1) +wget --quiet --directory-prefix=./registry/ https://raw.githubusercontent.com/docker/distribution/"$DISTRIBUTION_BRANCH"/docs/configuration.md || (echo "Failed registry/configuration.md download" && exit 1) # Remove things we don't want in the build rm ./registry/spec/api.md.tmpl From 573af666e4caf725162287a6accc07ddb4b9f9b2 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 7 Mar 2019 15:54:25 +0100 Subject: [PATCH 5/5] Move fetching "library samples" to a separate stage Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 12 +++++-- _scripts/fetch-library-samples.sh | 49 ++++++++++++++++++++++++++++ _scripts/fetch-upstream-resources.sh | 47 -------------------------- 3 files changed, 59 insertions(+), 49 deletions(-) create mode 100755 _scripts/fetch-library-samples.sh diff --git a/Dockerfile b/Dockerfile index 2f42486c19..ea9311d396 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,6 +63,15 @@ COPY --from=docs/docker.github.io:v17.09 ${TARGET} ${TARGET} COPY --from=docs/docker.github.io:v17.12 ${TARGET} ${TARGET} COPY --from=docs/docker.github.io:v18.03 ${TARGET} ${TARGET} +# Fetch library samples (documentation from official images on Docker Hub) +# Only add the files that are needed to build these reference docs, so that +# these docs are only rebuilt if changes were made to the configuration. +# @todo find a way to build HTML in this stage, and still have them included in the navigation tree +FROM builderbase AS library-samples +COPY ./_scripts/fetch-library-samples.sh ./_scripts/ +COPY ./_samples/boilerplate.txt ./_samples/ +RUN bash ./_scripts/fetch-library-samples.sh + # Fetch upstream resources (reference documentation) # Only add the files that are needed to build these reference docs, so that # these docs are only rebuilt if changes were made to the configuration. @@ -70,16 +79,15 @@ FROM builderbase AS upstream-resources COPY ./_scripts/fetch-upstream-resources.sh ./_scripts/ COPY ./_config.yml . COPY ./_data/toc.yaml ./_data/ -COPY ./_samples/boilerplate.txt ./_samples/ RUN bash ./_scripts/fetch-upstream-resources.sh . # Build the current docs from the checked out branch FROM builderbase AS current COPY . . +COPY --from=library-samples /usr/src/app/md_source/. ./ COPY --from=upstream-resources /usr/src/app/md_source/. ./ - # Build the static HTML, now that everything is in place RUN jekyll build -d ${TARGET} diff --git a/_scripts/fetch-library-samples.sh b/_scripts/fetch-library-samples.sh new file mode 100755 index 0000000000..e8b1d2c6ec --- /dev/null +++ b/_scripts/fetch-library-samples.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +# Get the Library docs +svn co https://github.com/docker-library/docs/trunk ./_samples/library || (echo "Failed library download" && exit 1) +# Remove symlinks to maintainer.md because they break jekyll and we don't use em +find ./_samples/library -maxdepth 9 -type l -delete +# Loop through the README.md files, turn them into rich index.md files +FILES=$(find ./_samples/library -type f -name 'README.md') +for f in ${FILES} +do + curdir=$(dirname "${f}") + justcurdir="${curdir##*/}" + if [ -e ${curdir}/README-short.txt ] + then + # shortrm=$(<${curdir}/README-short.txt) + shortrm=$(cat ${curdir}/README-short.txt) + fi + echo "Adding front-matter to ${f} ..." + echo --- >> ${curdir}/front-matter.txt + echo title: "${justcurdir}" >> ${curdir}/front-matter.txt + echo keywords: library, sample, ${justcurdir} >> ${curdir}/front-matter.txt + echo repo: "${justcurdir}" >> ${curdir}/front-matter.txt + echo layout: docs >> ${curdir}/front-matter.txt + echo permalink: /samples/library/${justcurdir}/ >> ${curdir}/front-matter.txt + echo redirect_from: >> ${curdir}/front-matter.txt + echo - /samples/${justcurdir}/ >> ${curdir}/front-matter.txt + echo description: \| >> ${curdir}/front-matter.txt + echo \ \ ${shortrm} >> ${curdir}/front-matter.txt + echo --- >> ${curdir}/front-matter.txt + echo >> ${curdir}/front-matter.txt + echo ${shortrm} >> ${curdir}/front-matter.txt + echo >> ${curdir}/front-matter.txt + if [ -e ${curdir}/github-repo ] + then + # gitrepo=$(<${curdir}/github-repo) + gitrepo=$(cat ${curdir}/github-repo) + echo >> ${curdir}/front-matter.txt + echo GitHub repo: \["${gitrepo}"\]\("${gitrepo}"\)\{: target="_blank"\} >> ${curdir}/front-matter.txt + echo >> ${curdir}/front-matter.txt + fi + cat ${curdir}/front-matter.txt ./_samples/boilerplate.txt > ${curdir}/header.txt + echo {% raw %} >> ${curdir}/header.txt + cat ${curdir}/header.txt ${curdir}/README.md > ${curdir}/index.md + echo {% endraw %} >> ${curdir}/index.md + rm -rf ${curdir}/front-matter.txt + rm -rf ${curdir}/header.txt +done + +rm ./_samples/library/index.md diff --git a/_scripts/fetch-upstream-resources.sh b/_scripts/fetch-upstream-resources.sh index 344b5576b9..81ffff7e4b 100755 --- a/_scripts/fetch-upstream-resources.sh +++ b/_scripts/fetch-upstream-resources.sh @@ -63,52 +63,6 @@ svn co https://github.com/docker/docker-ce/"$ENGINE_SVN_BRANCH"/components/engin svn co https://github.com/docker/distribution/"$DISTRIBUTION_SVN_BRANCH"/docs/spec ./registry/spec || (echo "Failed registry/spec download" && exit 1) svn co https://github.com/docker/compliance/trunk/docs/compliance ./compliance || (echo "Failed docker/compliance download" && exit 1) -# Get the Library docs -svn co https://github.com/docker-library/docs/trunk ./_samples/library || (echo "Failed library download" && exit 1) -# Remove symlinks to maintainer.md because they break jekyll and we don't use em -find ./_samples/library -maxdepth 9 -type l -delete -# Loop through the README.md files, turn them into rich index.md files -FILES=$(find ./_samples/library -type f -name 'README.md') -for f in $FILES -do - curdir=$(dirname "${f}") - justcurdir="${curdir##*/}" - if [ -e ${curdir}/README-short.txt ] - then - # shortrm=$(<${curdir}/README-short.txt) - shortrm=$(cat ${curdir}/README-short.txt) - fi - echo "Adding front-matter to ${f} ..." - echo --- >> ${curdir}/front-matter.txt - echo title: "${justcurdir}" >> ${curdir}/front-matter.txt - echo keywords: library, sample, ${justcurdir} >> ${curdir}/front-matter.txt - echo repo: "${justcurdir}" >> ${curdir}/front-matter.txt - echo layout: docs >> ${curdir}/front-matter.txt - echo permalink: /samples/library/${justcurdir}/ >> ${curdir}/front-matter.txt - echo redirect_from: >> ${curdir}/front-matter.txt - echo - /samples/${justcurdir}/ >> ${curdir}/front-matter.txt - echo description: \| >> ${curdir}/front-matter.txt - echo \ \ ${shortrm} >> ${curdir}/front-matter.txt - echo --- >> ${curdir}/front-matter.txt - echo >> ${curdir}/front-matter.txt - echo ${shortrm} >> ${curdir}/front-matter.txt - echo >> ${curdir}/front-matter.txt - if [ -e ${curdir}/github-repo ] - then - # gitrepo=$(<${curdir}/github-repo) - gitrepo=$(cat ${curdir}/github-repo) - echo >> ${curdir}/front-matter.txt - echo GitHub repo: \["${gitrepo}"\]\("${gitrepo}"\)\{: target="_blank"\} >> ${curdir}/front-matter.txt - echo >> ${curdir}/front-matter.txt - fi - cat ${curdir}/front-matter.txt ./_samples/boilerplate.txt > ${curdir}/header.txt - echo {% raw %} >> ${curdir}/header.txt - cat ${curdir}/header.txt ${curdir}/README.md > ${curdir}/index.md - echo {% endraw %} >> ${curdir}/index.md - rm -rf ${curdir}/front-matter.txt - rm -rf ${curdir}/header.txt -done - # Get the Engine APIs that are in Swagger # Be careful with the locations on Github for these # When you change this you need to make sure to copy the previous @@ -143,4 +97,3 @@ wget --quiet --directory-prefix=./registry/ https://raw.gith rm ./registry/spec/api.md.tmpl rm -rf ./apidocs/cloud-api-source rm -rf ./tests -rm ./_samples/library/index.md