-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
58 lines (49 loc) Β· 1.61 KB
/
deploy.sh
File metadata and controls
58 lines (49 loc) Β· 1.61 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Quick deployment script for server without Node.js
# Usage: ./deploy.sh
set -e
echo "π Starting deployment..."
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "β Docker is not installed. Please install Docker first."
exit 1
fi
# Check if Docker Compose is installed
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "β Docker Compose is not installed. Please install Docker Compose first."
exit 1
fi
# Check if .env file exists
if [ ! -f .env ]; then
echo "β οΈ .env file not found. Creating from .env.example..."
if [ -f .env.example ]; then
cp .env.example .env
echo "β
Created .env file. Please edit it with your environment variables."
exit 1
else
echo "β .env file not found and no .env.example to copy from."
echo "Please create .env file with required environment variables."
exit 1
fi
fi
# Build and start containers
echo "π¦ Building Docker image..."
docker-compose build
echo "π Starting containers..."
docker-compose up -d
echo "β³ Waiting for app to start..."
sleep 5
# Check if container is running
if docker-compose ps | grep -q "Up"; then
echo "β
Deployment successful!"
echo ""
echo "Your app should be running at: http://localhost:3000"
echo ""
echo "Useful commands:"
echo " View logs: docker-compose logs -f"
echo " Stop app: docker-compose down"
echo " Restart app: docker-compose restart"
else
echo "β Deployment failed. Check logs with: docker-compose logs"
exit 1
fi