diff options
author | 2018-06-13 13:19:49 +0100 | |
---|---|---|
committer | 2018-08-27 20:28:40 +0200 | |
commit | 15b0ba27cfb8ce7c29711d809d58f56ea4be99ba (patch) | |
tree | 2997c3cbe678402aaad25552fb45c7cc0276b1d5 /scripts | |
parent | Add GitLab CI linting. (diff) |
Push site base image on CI.
Diffstat (limited to 'scripts')
-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..1bf8ce00 --- /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/base.Dockerfile | wc -l) + + if [ $changed_lines != '0' ]; then + echo "base.Dockerfile was changed" + + echo "Building CI container" + docker build -t pythondiscord/django-site-ci:latest -f docker/base.Dockerfile . + + echo "Pushing image to Docker Hub" + docker push pythondiscord/django-site-ci:latest + else + echo "base.Dockerfile was not changed, not building" + fi +else + echo "Skipping CI Docker build" +fi |