make-quant-py/deploy.sh
Ayuriel 1a2a29aaf2
Some checks failed
Docker Build and Deploy / build-and-push (push) Successful in 1m9s
Docker Build and Deploy / deploy (push) Failing after 8s
feat: 배포 구성
2025-03-31 12:35:54 +09:00

46 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# This script pulls the latest image and deploys the application
# Load environment variables from .env file if it exists
if [ -f .env ]; then
export $(cat .env | grep -v '^#' | xargs)
fi
# Check if required environment variables are set
if [ -z "$GITEA_REGISTRY_URL" ] || [ -z "$GITEA_USERNAME" ] || [ -z "$GITEA_PASSWORD" ]; then
echo "Error: Missing required environment variables. Please check your .env file."
echo "Required variables: GITEA_REGISTRY_URL, GITEA_USERNAME, GITEA_PASSWORD"
exit 1
fi
# Login to Gitea registry
echo "Logging in to Gitea registry..."
echo $GITEA_PASSWORD | docker login ${GITEA_REGISTRY_URL} -u ${GITEA_USERNAME} --password-stdin
if [ $? -ne 0 ]; then
echo "Error: Failed to login to Gitea registry. Please check your credentials."
exit 1
fi
# Pull the latest image
echo "Pulling the latest image..."
docker pull ${GITEA_REGISTRY_URL}/quant/make-quant-py:latest
if [ $? -ne 0 ]; then
echo "Error: Failed to pull the latest image."
exit 1
fi
# Deploy with docker-compose
echo "Deploying the application..."
docker-compose down
docker-compose up -d
if [ $? -ne 0 ]; then
echo "Error: Failed to deploy the application."
exit 1
fi
echo "Deployment completed successfully!"