From 9b47229953fbbc6bbf0acf47fdc0d329d73ffbb7 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 3 Sep 2019 20:25:18 +0200 Subject: [PATCH] Remove script and build-stage for fetching library samples Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 14 --------- _scripts/fetch-library-samples.sh | 47 ------------------------------- 2 files changed, 61 deletions(-) delete mode 100755 _scripts/fetch-library-samples.sh diff --git a/Dockerfile b/Dockerfile index 581aef5545..07e4dec0e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,19 +64,6 @@ COPY --from=docs/docker.github.io:v17.12 ${TARGET} ${TARGET} COPY --from=docs/docker.github.io:v18.03 ${TARGET} ${TARGET} COPY --from=docs/docker.github.io:v18.09 ${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/ -RUN bash ./_scripts/fetch-library-samples.sh - -# Temporary stage to export the samples using; -# DOCKER_BUILDKIT=1 docker build --target=export-samples -o type=local,dest=./_samples/library/ . -FROM scratch AS export-samples -COPY --from=library-samples /usr/src/app/md_source/_samples/library/. / - # 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. @@ -90,7 +77,6 @@ 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 diff --git a/_scripts/fetch-library-samples.sh b/_scripts/fetch-library-samples.sh deleted file mode 100755 index 2d3dab80f7..0000000000 --- a/_scripts/fetch-library-samples.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/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 -# Remove the top-level README because we don't want to generate a file for that -rm ./_samples/library/README.md -# 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=$(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 hide_from_sitemap: true >> ${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 - fi - cat ${curdir}/front-matter.txt > ${curdir}/../${justcurdir}.md - echo {% include library-samples.md %} >> ${curdir}/../${justcurdir}.md -done - -# Remove all files and subdirectory, except for the Markdown files we generated -find ./_samples/library/ ! -name 'library' -type d -exec rm -rf {} + -find ./_samples/library/ ! -name '*.md' -type f -exec rm -f {} +