From abd2137a8f72183f7f4f2982c0bce9dd67aeef19 Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Tue, 7 Mar 2017 11:01:36 -0800 Subject: [PATCH] Use shallow clone and shallow checkout --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b2dd98cdef..c522d56d86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,12 @@ COPY nginx.conf /etc/nginx/nginx.conf ENV VERSIONS="v1.4 v1.5 v1.6 v1.7 v1.8 v1.9 v1.10 v1.11 v1.12 v1.13" -RUN git clone https://www.github.com/docker/docker.github.io archive_source; \ +## Use shallow clone and shallow check-outs to only get the tip of each branch + +RUN git clone --depth 1 https://www.github.com/docker/docker.github.io archive_source; \ for VER in $VERSIONS; do \ - git --git-dir=./archive_source/.git --work-tree=./archive_source checkout ${VER} \ + git --git-dir=./archive_source/.git --work-tree=./archive_source fetch origin ${VER}:${VER} --depth 1 \ + && git --git-dir=./archive_source/.git --work-tree=./archive_source checkout ${VER} \ && mkdir -p target/${VER} \ && jekyll build -s archive_source -d target/${VER} \ && find target/${VER} -type f -name '*.html' -print0 | xargs -0 sed -i 's#href="/#href="/'"$VER"'/#g' \