Update deploy.sh
This commit is contained in:
parent
75adbefaa4
commit
1f3d045f93
1 changed files with 3 additions and 5 deletions
8
.github/scripts/deploy.sh
vendored
8
.github/scripts/deploy.sh
vendored
|
|
@ -6,19 +6,17 @@ DOCKER_REGISTRY="ghcr.io"
|
||||||
DOCKER_USERNAME="pb-coding"
|
DOCKER_USERNAME="pb-coding"
|
||||||
DOCKER_IMAGE_NAME="skyjo-fe"
|
DOCKER_IMAGE_NAME="skyjo-fe"
|
||||||
CONTAINER_NAME="skyjo-fe"
|
CONTAINER_NAME="skyjo-fe"
|
||||||
TARGET_DIRECTORY="/home/pb1497/deployments/$CONTAINER_NAME"
|
|
||||||
DOCKER_NETWORK="swag_net"
|
DOCKER_NETWORK="swag_net"
|
||||||
|
DOCKER_REGISTRY_TOKEN=$1
|
||||||
|
|
||||||
# Authenticate with Docker registry
|
# Authenticate with Docker registry
|
||||||
echo "Authenticating with Docker registry..."
|
echo "Authenticating with Docker registry..."
|
||||||
docker login -u $DOCKER_USERNAME --password $GITHUB_TOKEN $DOCKER_REGISTRY
|
docker login -u $DOCKER_USERNAME --password $DOCKER_REGISTRY_TOKEN $DOCKER_REGISTRY
|
||||||
|
|
||||||
# Pull the latest Docker image
|
# Pull the latest Docker image
|
||||||
echo "Pulling the latest Docker image..."
|
echo "Pulling the latest Docker image..."
|
||||||
docker pull $DOCKER_REGISTRY/$DOCKER_USERNAME/$DOCKER_IMAGE_NAME:latest
|
docker pull $DOCKER_REGISTRY/$DOCKER_USERNAME/$DOCKER_IMAGE_NAME:latest
|
||||||
|
|
||||||
cd $TARGET_DIRECTORY
|
|
||||||
|
|
||||||
# Stop and remove the existing container if it exists
|
# Stop and remove the existing container if it exists
|
||||||
if [ "$(docker ps -aq -f name=$CONTAINER_NAME)" ]; then
|
if [ "$(docker ps -aq -f name=$CONTAINER_NAME)" ]; then
|
||||||
echo "Stopping and removing the existing container..."
|
echo "Stopping and removing the existing container..."
|
||||||
|
|
@ -34,4 +32,4 @@ docker run -d \
|
||||||
-v $TARGET_DIRECTORY:/app \
|
-v $TARGET_DIRECTORY:/app \
|
||||||
$DOCKER_REGISTRY/$DOCKER_USERNAME/$DOCKER_IMAGE_NAME:latest
|
$DOCKER_REGISTRY/$DOCKER_USERNAME/$DOCKER_IMAGE_NAME:latest
|
||||||
|
|
||||||
echo "Deployment complete."
|
echo "Deployment complete."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue