#!/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."