feat: Containerize the application with Docker and Docker Compose, including a PostgreSQL database and a deployment script.
This commit is contained in:
23
deploy.sh
Executable file
23
deploy.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/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!"
|
||||
Reference in New Issue
Block a user