aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/deploy-azure.sh
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-01-01 19:22:48 +0100
committerGravatar Johannes Christ <[email protected]>2019-01-01 19:22:48 +0100
commit06d866fbffff87913e05f6c0b3b5ba788e9def06 (patch)
treebd8d7edf9729c0c6ba1bdfeec8e31fac99963e17 /scripts/deploy-azure.sh
parentRemove superfluous `self.headers` setting. (diff)
parentMerge pull request #242 from python-discord/eval-indent-fix (diff)
Merge branch 'master' into django
Diffstat (limited to 'scripts/deploy-azure.sh')
-rw-r--r--scripts/deploy-azure.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/deploy-azure.sh b/scripts/deploy-azure.sh
new file mode 100644
index 000000000..6b3dea508
--- /dev/null
+++ b/scripts/deploy-azure.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+cd ..
+
+# Build and deploy on master branch, only if not a pull request
+if [[ ($BUILD_SOURCEBRANCHNAME == 'master') && ($SYSTEM_PULLREQUEST_PULLREQUESTID == '') ]]; then
+ changed_lines=$(git diff HEAD~1 HEAD docker/base.Dockerfile | wc -l)
+
+ if [ $changed_lines != '0' ]; then
+ echo "base.Dockerfile was changed"
+
+ echo "Building bot base"
+ docker build -t pythondiscord/bot-base:latest -f docker/base.Dockerfile .
+
+ echo "Pushing image to Docker Hub"
+ docker push pythondiscord/bot-base:latest
+ else
+ echo "base.Dockerfile was not changed, not building"
+ fi
+
+ echo "Building image"
+ docker build -t pythondiscord/bot:latest -f docker/bot.Dockerfile .
+
+ echo "Pushing image"
+ docker push pythondiscord/bot:latest
+
+ echo "Deploying container"
+ curl -H "token: $1" $2
+else
+ echo "Skipping deploy"
+fi \ No newline at end of file