aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/deploy.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/deploy.sh')
-rwxr-xr-xscripts/deploy.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/deploy.sh b/scripts/deploy.sh
new file mode 100755
index 0000000..b7ecf74
--- /dev/null
+++ b/scripts/deploy.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+# Assign arguments to variables
+IMAGE_NAME="pyblackbird"
+TAG="latest" # Adjust tagging strategy as needed
+DOCKER_REGISTRY="registry.gitlab.com/yulqen" # Docker registry URL
+
+SERVER_HOST="substracker-web"
+
+# SSH into server to pull the image, restart the container, and configure NGINX and Certbot
+#ssh -i $SSH_KEY_PATH $SSH_USER@$SERVER_HOST << EOF
+ssh $SERVER_HOST << EOF
+
+# Stop and remove the existing container if it exists
+docker stop $IMAGE_NAME || true
+docker rm $IMAGE_NAME || true
+docker rmi $DOCKER_REGISTRY/$IMAGE_NAME:$TAG || true
+
+# run using the .env file for config settings
+cd code/pyblackbird && docker run -d --rm --name pyblackbird --mount type=bind,src=/home/surge/code/pyblackbird/data,dst=/app/data --env-file .env -p 8080:8080 $DOCKER_REGISTRY/$IMAGE_NAME:$TAG
+
+EOF
+
+echo "Deployment complete."