File size: 605 Bytes
c98003e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/bash
set -e

echo "===== Application Startup at $(date -u +%Y-%m-%dT%H:%M:%S) ====="

# Start Flask backend in background
echo "Starting Flask backend..."
cd /app
gunicorn --bind 127.0.0.1:5000 --workers 1 --timeout 120 backend.app:app &
BACKEND_PID=$!

# Wait for backend to be ready
echo "Waiting for backend to start..."
for i in $(seq 1 10); do
    if curl -s http://127.0.0.1:5000/api/health > /dev/null 2>&1; then
        echo "Backend is ready (attempt $i)"
        break
    fi
    sleep 1
done

# Start nginx in foreground
echo "Starting nginx on port 7860..."
exec nginx -g 'daemon off;'