Files
servesync-demo/backend/Dockerfile
Forge 46fd2953c3 🏓 Initial ServeSync demo build
- FastAPI backend with PostgreSQL + Redis
- 4 core features: Registration, Courts, Matchmaking, Tournament
- Double elimination tournament with bracket visualization
- ELO-based matchmaking (Stage 1 Open, Stage 2 Skill-Based)
- Real-time WebSocket updates
- TV Screen display for courts
- Vue 3 + Tailwind CSS frontend
- Seed data: 12 players, 4 courts, active matches, tournament in progress
- Docker compose stack with Nginx reverse proxy
2026-03-19 00:58:17 +08:00

44 lines
861 B
Docker

FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
gcc \
libpq-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
# Create startup script
RUN cat > /start.sh << 'EOF'
#!/bin/bash
set -e
echo "Waiting for database..."
until python -c "
import psycopg2, os
try:
conn = psycopg2.connect(os.environ.get('DATABASE_URL', 'postgresql://servesync:servesync@db:5432/servesync'))
conn.close()
print('DB ready')
except Exception as e:
print(f'DB not ready: {e}')
exit(1)
"; do
sleep 2
done
echo "Running seed..."
python seed.py || echo "Seed already ran or error (continuing)"
echo "Starting server..."
exec uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
EOF
RUN chmod +x /start.sh
EXPOSE 8000
CMD ["/start.sh"]