-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·55 lines (44 loc) · 1.36 KB
/
deploy.sh
File metadata and controls
executable file
·55 lines (44 loc) · 1.36 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
#!/bin/bash
# Digital Ocean deployment script for ShortsCreator Video Editor API
set -e
echo "🚀 Starting Digital Ocean deployment..."
# Configuration
APP_NAME="shorts-creator"
DOCKER_IMAGE="$APP_NAME:latest"
CONTAINER_NAME="$APP_NAME-container"
# Build Docker image
echo "📦 Building Docker image..."
docker build -t $DOCKER_IMAGE .
# Stop and remove existing container if it exists
echo "🔄 Stopping existing container..."
docker stop $CONTAINER_NAME 2>/dev/null || true
docker rm $CONTAINER_NAME 2>/dev/null || true
# Run new container
echo "🆕 Starting new container..."
docker run -d \
--name $CONTAINER_NAME \
--restart unless-stopped \
-p 5000:5000 \
-v $(pwd)/temp:/app/temp \
-v $(pwd)/uploads:/app/uploads \
-v $(pwd)/jobs:/app/jobs \
-v $(pwd)/static:/app/static \
$DOCKER_IMAGE
# Wait for container to be ready
echo "⏳ Waiting for container to be ready..."
sleep 10
# Check container status
if docker ps | grep -q $CONTAINER_NAME; then
echo "✅ Deployment successful!"
echo "🌐 API is running at: http://localhost:5000"
echo "📊 Health check: http://localhost:5000/health"
# Show container logs
echo "📋 Recent logs:"
docker logs --tail 20 $CONTAINER_NAME
else
echo "❌ Deployment failed!"
echo "📋 Container logs:"
docker logs $CONTAINER_NAME
exit 1
fi
echo "🎉 Deployment complete!"