Spaces:
Sleeping
Sleeping
| set -e | |
| echo "================================================" | |
| echo " Ark.Alliance.StartupCms.AI - HuggingFace" | |
| echo "================================================" | |
| # Check if this is a first run (database doesn't exist) | |
| if [ ! -f "/data/startupcms.db" ]; then | |
| echo "[INFO] First run detected - database will be initialized and seeded" | |
| export SEED_DATABASE=true | |
| fi | |
| # Start Express backend in background | |
| echo "[1/2] Starting backend on port 3085..." | |
| cd /app | |
| node dist/index.js & | |
| # Wait for backend to be ready (including database seeding) | |
| echo "[...] Waiting for backend initialization..." | |
| sleep 10 | |
| # Verify backend is running | |
| if curl -s http://127.0.0.1:3085/api/health > /dev/null 2>&1; then | |
| echo "[OK] Backend is healthy" | |
| else | |
| echo "[WARN] Backend health check pending..." | |
| fi | |
| # Start Nginx (foreground to keep container running) | |
| echo "[2/2] Starting Nginx on port 7860..." | |
| nginx -g 'daemon off;' | |