aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2018-08-31 21:04:15 +0000
committerGravatar Johannes Christ <[email protected]>2018-08-31 21:04:15 +0000
commit52462b6fc5be74a6150530218ebe1b24e5e899e5 (patch)
tree8c6e0c238e25225fd55da0f99bb3aedcb9847aae /scripts
parentAdd a `Dockerfile`. (diff)
parentAlways 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')
-rwxr-xr-xscripts/deploy-ci.sh19
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