From 5249ec11a5a8034404ebf47fbc8fca4774b7d117 Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Mon, 6 Mar 2017 15:18:18 -0800 Subject: [PATCH] Trigger build of docs-base after successful build of archive branch --- .dockerignore | 2 ++ Dockerfile | 8 -------- hooks/post_push | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 .dockerignore create mode 100755 hooks/post_push diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..a244c17ae6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +_site diff --git a/Dockerfile b/Dockerfile index 3d807d67e6..f1f697a9ee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,3 @@ FROM starefossen/github-pages:onbuild -ONBUILD RUN git clone https://www.github.com/docker/docker.github.io docs - -ONBUILD WORKDIR docs - -ONBUILD RUN git checkout v1.5 - -ONBUILD COPY . /usr/src/app - CMD jekyll serve -d /_site --watch -H 0.0.0.0 -P 4000 diff --git a/hooks/post_push b/hooks/post_push new file mode 100755 index 0000000000..e258f1c0ea --- /dev/null +++ b/hooks/post_push @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +# If this is an archive branch (like v1.4 or v1.11), +# build and push the docs-base branch at the end of +# a successful build of the branch + +if [[ $SOURCE_BRANCH =~ ^v1\.[0-9]+$ ]]; then + git fetch origin docs-base:docs-base --depth 1 || ( echo "Couldn't fetch docs-base." && exit 1 ) + git checkout docs-base || ( echo "Couldn't check out docs-base." && exit 1 ) + docker build -t docs/docker.github.io:docs-base . || ( echo "Couldn't build docs-base Dockerfile." && exit 1 ) + docker push docs/docker.github.io:docs-base || ( echo "Coudn't push new docs-base image." && exit 1 ) +fi