mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
Remove script and build-stage for fetching library samples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
14
Dockerfile
14
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
|
||||
|
||||
@@ -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 {} +
|
||||
Reference in New Issue
Block a user