aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Christopher Baklid <[email protected]>2018-04-28 14:28:35 +0200
committerGravatar GitHub <[email protected]>2018-04-28 14:28:35 +0200
commit54369f64c628e957d6c4a6953f2407d0f3df8564 (patch)
tree64ad79ccdadb35a955c52a70131682de4f9efa28 /scripts
parentAdd help channel 4 (diff)
adds dockerfile that uses pipenv (#60)
Dockerfile and new deploy flow that builds the container in travis
Diffstat (limited to 'scripts')
-rw-r--r--scripts/deploy.py8
-rw-r--r--scripts/deploy.sh16
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/deploy.py b/scripts/deploy.py
new file mode 100644
index 000000000..04f3e8229
--- /dev/null
+++ b/scripts/deploy.py
@@ -0,0 +1,8 @@
+import os
+
+import requests
+
+url = os.environ.get("AUTODEPLOY_WEBHOOK")
+token = os.environ.get("AUTODEPLOY_TOKEN")
+result = requests.get(url=url, headers={'token': token})
+print(result.text)
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
new file mode 100644
index 000000000..98b9a9462
--- /dev/null
+++ b/scripts/deploy.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Build and deploy on master branch
+if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then
+ echo "Connecting to docker hub"
+ echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
+
+ echo "Building image"
+ docker build -t pythondiscord/bot:latest .
+
+ echo "Pushing image"
+ docker push pythondiscord/bot:latest
+
+ echo "Deploying container"
+ pipenv run python scripts/deploy.py
+fi