diff options
author | 2018-06-13 13:19:49 +0100 | |
---|---|---|
committer | 2018-06-13 13:19:49 +0100 | |
commit | 91f3e8e359e4092fc26715a810fedc2c41307862 (patch) | |
tree | 26b2947361e9fd875643b3c85e7c4ea8e1b52e2d /scripts/deploy-ci.sh | |
parent | Add JavaScript linting (diff) |
Build CI container on the CI
Diffstat (limited to '')
-rw-r--r-- | scripts/deploy-ci.sh | 23 |
1 files changed, 23 insertions, 0 deletions
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 |