diff options
author | 2018-08-31 21:04:15 +0000 | |
---|---|---|
committer | 2018-08-31 21:04:15 +0000 | |
commit | 52462b6fc5be74a6150530218ebe1b24e5e899e5 (patch) | |
tree | 8c6e0c238e25225fd55da0f99bb3aedcb9847aae /scripts/deploy-ci.sh | |
parent | Add a `Dockerfile`. (diff) | |
parent | Always upload cov reports, add pipenv cache. (diff) |
Merge branch 'django+add-gitlab-ci' into 'django'
Django - Add GitLab CI.
See merge request python-discord/projects/site!36
Diffstat (limited to 'scripts/deploy-ci.sh')
-rwxr-xr-x | scripts/deploy-ci.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/deploy-ci.sh b/scripts/deploy-ci.sh new file mode 100755 index 00000000..f5c965ca --- /dev/null +++ b/scripts/deploy-ci.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Build and deploy on master branch +echo "Connecting to docker hub" +echo "$GITLAB_DOCKER_PASSWORD" | docker login --username "$GITLAB_DOCKER_USERNAME" --password-stdin registry.gitlab.com + +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 registry.gitlab.com/python-discord/projects/site/django-base:latest -f docker/base.Dockerfile . + + echo "Pushing image to GitLab registry" + docker push registry.gitlab.com/python-discord/projects/site/django-base:latest +else + echo "base.Dockerfile was not changed, not building" +fi |