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 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: - "8000: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://localhost:8000 - NEXT_PUBLIC_WS_URL=ws://localhost:8000 volumes: - ./frontend:/app - /app/node_modules - /app/.next ports: - "3000:3000" depends_on: - backend restart: unless-stopped volumes: postgres_data: