24 lines
730 B
Bash
Executable File
24 lines
730 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Load environment variables from .env if it exists
|
|
if [ -f .env ]; then
|
|
export $(grep -v '^#' .env | xargs)
|
|
fi
|
|
|
|
# Name of the database container
|
|
DB_CONTAINER_NAME="portfolio-db"
|
|
|
|
# Check if the database container is already running
|
|
if [ "$(docker ps -q -f name=${DB_CONTAINER_NAME})" ]; then
|
|
echo "✅ Database container '${DB_CONTAINER_NAME}' is already running."
|
|
echo "🚀 Deploying/Updating only the application..."
|
|
docker-compose up -d --no-recreate db
|
|
docker-compose up -d app
|
|
else
|
|
echo "⚠️ Database container '${DB_CONTAINER_NAME}' not found or stopped."
|
|
echo "🏗️ Deploying full stack (Database + App)..."
|
|
docker-compose up -d
|
|
fi
|
|
|
|
echo "✨ Deployment script finished!"
|