-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
44 lines (35 loc) · 1.44 KB
/
deploy.sh
File metadata and controls
44 lines (35 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Production deployment script for First Principles documentation app
set -e # Exit immediately if a command exits with a non-zero status
echo "🚀 Starting deployment process..."
# Check for docker and docker-compose
if ! command -v docker &> /dev/null || ! command -v docker-compose &> /dev/null; then
echo "❌ Docker and/or docker-compose are not installed. Please install them first."
exit 1
fi
# Pull latest changes if connected to a repository
if [ -d ".git" ]; then
echo "📦 Updating repository..."
git pull
fi
# Build the production image
echo "🏗️ Building production Docker image..."
docker-compose -f docker-compose.prod.yml build
# Stop any existing containers
echo "🛑 Stopping existing containers if running..."
docker-compose -f docker-compose.prod.yml down || true
# Start the production containers
echo "🚀 Starting production containers..."
docker-compose -f docker-compose.prod.yml up -d
# Check if the container is running
echo "🔍 Checking container status..."
sleep 5
if [ "$(docker ps -q -f name=first-principles-prod)" ]; then
echo "✅ Deployment completed successfully!"
echo "📝 Application logs will be available with: docker logs first-principles-prod -f"
echo "🌐 Application should now be accessible at http://localhost"
else
echo "❌ Deployment failed. Container is not running."
echo "📋 Check logs with: docker-compose -f docker-compose.prod.yml logs"
exit 1
fi