From 91f3e8e359e4092fc26715a810fedc2c41307862 Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Wed, 13 Jun 2018 13:19:49 +0100 Subject: Build CI container on the CI --- scripts/deploy-ci.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 scripts/deploy-ci.sh (limited to 'scripts/deploy-ci.sh') diff --git a/scripts/deploy-ci.sh b/scripts/deploy-ci.sh new file mode 100644 index 00000000..6a3d64bc --- /dev/null +++ b/scripts/deploy-ci.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Build and deploy on master branch +if [[ $CI_COMMIT_REF_SLUG == 'master' ]]; then + echo "Connecting to docker hub" + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + + changed_lines=$(git diff HEAD~1 HEAD docker/ci.Dockerfile | wc -l) + + if [ $changed_lines != '0' ]; then + echo "ci.Dockerfile was changed" + + echo "Building CI container" + docker build -t pythondiscord/site-ci:latest -f docker/ci.Dockerfile . + + echo "Pushing image to Docker Hub" + docker push pythondiscord/site-ci:latest + else + echo "ci.Dockerfile was not changed, not building" + fi +else + echo "Skipping CI Docker build" +fi -- cgit v1.2.3