From 8eb6ee6cb81380b76667d806cca3c1c7b232f8a1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 15 Mar 2020 18:22:16 +0100 Subject: [PATCH 1/5] Add more files to .dockerignore Signed-off-by: Sebastiaan van Stijn --- .dockerignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.dockerignore b/.dockerignore index f066a47962..5083b67c19 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,11 +1,18 @@ .dockerignore +.DS_Store .git +.github .gitignore +.gitmodules +.idea +.jekyll-metadata +.sass-cache tests _site CONTRIBUTING.md Dockerfile Dockerfile.archive docker-compose.yml +Gemfile Gemfile.lock Jenkinsfile From a5ab6fa4f8bb4a35473db6aca3640c0b5031b235 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 15 Mar 2020 18:22:56 +0100 Subject: [PATCH 2/5] fetch-upstream-resources: fix .svn cleanup step Signed-off-by: Sebastiaan van Stijn --- _scripts/fetch-upstream-resources.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_scripts/fetch-upstream-resources.sh b/_scripts/fetch-upstream-resources.sh index 924f1cbec2..66a804571e 100755 --- a/_scripts/fetch-upstream-resources.sh +++ b/_scripts/fetch-upstream-resources.sh @@ -24,7 +24,7 @@ svn co "https://github.com/docker/distribution/${distribution_svn_branch}/docs/s svn co "https://github.com/mirantis/compliance/trunk/docs/compliance" ./compliance || (echo "Failed docker/compliance download" && exit 1) # Cleanup svn directories -find . -name .svn -exec rm -rf '{}' \; +find . -name ".svn" -print0 | xargs -0 /bin/rm -rf # Get the Engine APIs that are in Swagger # Add a new engine/api/.md file to add a new API version page. From 07d410de21d8795a05d4d623f1063efbbc48a668 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 15 Mar 2020 18:25:30 +0100 Subject: [PATCH 3/5] Dockerfile: fix links in same step as generating the files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For intermediate stages, it's generally ok to perform steps separately, however in this case, fixing the links would happen every time the HTML was generated, so we might as well do it in the same step, to reduce the size of the local build cache, as it was adding 54MB for each rebuild: IMAGE CREATED CREATED BY SIZE COMMENT 7d97d86ae290 3 minutes ago RUN /bin/sh -c find ${TARGET} -type f -name … 53.7MB buildkit.dockerfile.v0 3 minutes ago RUN /bin/sh -c jekyll build -d ${TARGET} # b… 375MB buildkit.dockerfile.v0 Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 71001c918f..1e4a008b05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -71,8 +71,8 @@ COPY --from=upstream-resources /usr/src/app/md_source/. ./ # substitute the "{site.latest_engine_api_version}" in the title for the latest # API docs, based on the latest_engine_api_version parameter in _config.yml RUN ./_scripts/update-api-toc.sh -RUN jekyll build -d ${TARGET} -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 +RUN jekyll build -d ${TARGET} \ + && 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 # This stage only contains the generated files. It can be used to host the From b7d91ae175c9c7db7b8fb483a143ebbc32120cc0 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 15 Mar 2020 22:43:11 +0100 Subject: [PATCH 4/5] Dockerfile: use alpine for fetching external resources This step does not depend on Jekyll, so using a minimal base-image. Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1e4a008b05..a2250b8497 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,8 +58,12 @@ FROM archives-${ENABLE_ARCHIVES} AS archives # Only add the files that are needed to build these reference docs, so that these # docs are only rebuilt if changes were made to ENGINE_BRANCH or DISTRIBUTION_BRANCH. # Disable caching (docker build --no-cache) to force updating these docs. -FROM builderbase AS upstream-resources +FROM alpine AS upstream-resources +RUN apk add --no-cache subversion wget +WORKDIR /usr/src/app/md_source/ COPY ./_scripts/fetch-upstream-resources.sh ./_scripts/ +ARG ENGINE_BRANCH +ARG DISTRIBUTION_BRANCH RUN ./_scripts/fetch-upstream-resources.sh . From 2f2ce53a512d58b2ff9e78fc0c913fea094edfa5 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sun, 15 Mar 2020 22:44:44 +0100 Subject: [PATCH 5/5] Dockerfile: update to gh-pages 198 Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 4 +--- Gemfile | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index a2250b8497..6674f6b355 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,9 +24,7 @@ ARG ENABLE_ARCHIVES=true ### # Set up base stages for building and deploying ### - -# Get basic configs and Jekyll env -FROM docs/docker.github.io:docs-builder AS builderbase +FROM starefossen/github-pages:198 AS builderbase ENV TARGET=/usr/share/nginx/html WORKDIR /usr/src/app/md_source/ diff --git a/Gemfile b/Gemfile index f6e2dd018e..f5ffef68d3 100644 --- a/Gemfile +++ b/Gemfile @@ -39,5 +39,5 @@ source "https://rubygems.org" # live site deploy, which uses the Dockerfiles found in the publish-tools # branch. -gem "github-pages", "177" +gem "github-pages", "198" gem 'wdm' if Gem.win_platform?