From c5f8add5f55399672d945d75c233c2ef1831a1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 13 Mar 2019 15:33:02 +0100 Subject: [PATCH] Made it easier to rebuild the Docker image after someone else built it Because we only pushed the final image to Docker Hub, it was impossible to pull the base image someone else created and "quickly" build a new deploy image. Now the deploy scripts push (some) of the intermediate images as well, making it possible to pull them later. I've added `build-pull.sh` and `full-pull.sh` to perform this pull and built up from the pulled images. --- deploy/build-all.sh | 42 ++++++++++++++++++++++++++++++++++- deploy/build-pull.sh | 1 + deploy/build-quick.sh | 33 +-------------------------- deploy/full-all.sh | 10 ++++++++- deploy/full-pull.sh | 1 + deploy/full-quick.sh | 2 +- docker/3_buildwheels/build.sh | 2 +- 7 files changed, 55 insertions(+), 36 deletions(-) mode change 120000 => 100755 deploy/build-all.sh create mode 120000 deploy/build-pull.sh mode change 100755 => 120000 deploy/build-quick.sh create mode 120000 deploy/full-pull.sh mode change 100755 => 120000 deploy/full-quick.sh diff --git a/deploy/build-all.sh b/deploy/build-all.sh deleted file mode 120000 index 681ade2..0000000 --- a/deploy/build-all.sh +++ /dev/null @@ -1 +0,0 @@ -build-quick.sh \ No newline at end of file diff --git a/deploy/build-all.sh b/deploy/build-all.sh new file mode 100755 index 0000000..557b11a --- /dev/null +++ b/deploy/build-all.sh @@ -0,0 +1,41 @@ +#!/bin/bash -e + +# macOS does not support readlink -f, so we use greadlink instead +if [[ `uname` == 'Darwin' ]]; then + command -v greadlink 2>/dev/null 2>&1 || { echo >&2 "Install greadlink using brew."; exit 1; } + readlink='greadlink' +else + readlink='readlink' +fi +ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")" + +case "$(basename "$0")" in + build-pull.sh) + docker pull armadillica/pillar_py:3.6 + docker pull armadillica/pillar_wheelbuilder:latest + pushd "$ROOT/docker/3_buildwheels" + ./build.sh + popd + ;& + build-quick.sh) + pushd "$ROOT/docker/4_run" + ./build.sh + ;; + build-all.sh) + pushd "$ROOT/docker" + ./full_rebuild.sh + ;; + *) + echo "Unknown script $0, aborting" >&2 + exit 1 +esac + +popd +echo +echo "Press [ENTER] to push the new Docker images." +read dummy +docker push armadillica/pillar_py:3.6 +docker push armadillica/pillar_wheelbuilder:latest +docker push armadillica/blender_cloud:latest +echo +echo "Build is done, ready to update the server." diff --git a/deploy/build-pull.sh b/deploy/build-pull.sh new file mode 120000 index 0000000..681ade2 --- /dev/null +++ b/deploy/build-pull.sh @@ -0,0 +1 @@ +build-quick.sh \ No newline at end of file diff --git a/deploy/build-quick.sh b/deploy/build-quick.sh deleted file mode 100755 index 54f421d..0000000 --- a/deploy/build-quick.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -e - -# macOS does not support readlink -f, so we use greadlink instead -if [[ `uname` == 'Darwin' ]]; then - command -v greadlink 2>/dev/null 2>&1 || { echo >&2 "Install greadlink using brew."; exit 1; } - readlink='greadlink' -else - readlink='readlink' -fi -ROOT="$(dirname "$(dirname "$($readlink -f "$0")")")" - -case "$(basename "$0")" in - build-quick.sh) - pushd "$ROOT/docker/4_run" - ./build.sh - ;; - build-all.sh) - pushd "$ROOT/docker" - ./full_rebuild.sh - ;; - *) - echo "Unknown script $0, aborting" >&2 - exit 1 -esac - -popd -echo -echo "Press [ENTER] to push the new Docker image." -read dummy -docker push armadillica/blender_cloud:latest -echo -echo "Build is done, ready to update the server." diff --git a/deploy/build-quick.sh b/deploy/build-quick.sh new file mode 120000 index 0000000..b415698 --- /dev/null +++ b/deploy/build-quick.sh @@ -0,0 +1 @@ +build-all.sh \ No newline at end of file diff --git a/deploy/full-all.sh b/deploy/full-all.sh index e00c958..bbf7a51 100755 --- a/deploy/full-all.sh +++ b/deploy/full-all.sh @@ -1 +1,9 @@ -./2docker.sh && ./build-all.sh && ./2server.sh cloud2 +#!/bin/bash + +set -e + +NAME="$(basename "$0")" + +./2docker.sh +./${NAME/full-/build-} +./2server.sh cloud2 diff --git a/deploy/full-pull.sh b/deploy/full-pull.sh new file mode 120000 index 0000000..6ba6114 --- /dev/null +++ b/deploy/full-pull.sh @@ -0,0 +1 @@ +full-all.sh \ No newline at end of file diff --git a/deploy/full-quick.sh b/deploy/full-quick.sh deleted file mode 100755 index 756a140..0000000 --- a/deploy/full-quick.sh +++ /dev/null @@ -1 +0,0 @@ -./2docker.sh && ./build-quick.sh && ./2server.sh cloud2 diff --git a/deploy/full-quick.sh b/deploy/full-quick.sh new file mode 120000 index 0000000..6ba6114 --- /dev/null +++ b/deploy/full-quick.sh @@ -0,0 +1 @@ +full-all.sh \ No newline at end of file diff --git a/docker/3_buildwheels/build.sh b/docker/3_buildwheels/build.sh index 6f36a8b..da0b517 100755 --- a/docker/3_buildwheels/build.sh +++ b/docker/3_buildwheels/build.sh @@ -22,7 +22,7 @@ fi echo "Wheelhouse is $WHEELHOUSE" mkdir -p "$WHEELHOUSE" -docker build -t pillar_wheelbuilder . +docker build -t armadillica/pillar_wheelbuilder:latest . GID=$(id -g) docker run --rm -i \