80 lines
1.9 KiB
YAML
80 lines
1.9 KiB
YAML
services:
|
|
# Main application database
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: sp-db
|
|
environment:
|
|
POSTGRES_USER: sport_prog
|
|
POSTGRES_PASSWORD: secret
|
|
POSTGRES_DB: sport_programming
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
# ports:
|
|
# - "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U sport_prog -d sport_programming"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
|
|
# Piston - code execution engine (replaces Judge0)
|
|
piston:
|
|
image: ghcr.io/engineer-man/piston
|
|
container_name: sp-piston
|
|
ports:
|
|
- "2000:2000"
|
|
privileged: true
|
|
restart: unless-stopped
|
|
entrypoint: ["/bin/bash", "/piston-init/entrypoint.sh"]
|
|
volumes:
|
|
- ./piston/entrypoint.sh:/piston-init/entrypoint.sh:ro
|
|
- piston_packages:/piston/packages
|
|
tmpfs:
|
|
- /piston/jobs:exec,mode=777
|
|
|
|
# FastAPI backend
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
container_name: sp-backend
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://sport_prog:secret@db:5432/sport_programming
|
|
- PISTON_URL=http://piston:2000
|
|
- SECRET_KEY=your-super-secret-key-change-in-production
|
|
- CORS_ORIGINS=http://localhost:3000
|
|
volumes:
|
|
- ./backend:/app
|
|
ports:
|
|
- "8091:8000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
piston:
|
|
condition: service_started
|
|
restart: unless-stopped
|
|
|
|
# Next.js frontend
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: sp-frontend
|
|
environment:
|
|
- NEXT_PUBLIC_API_URL=http://192.168.50.130:8091
|
|
- NEXT_PUBLIC_WS_URL=ws://192.168.50.130:8091
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
- /app/.next
|
|
ports:
|
|
- "3091:3000"
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
piston_packages:
|