version: "3.9" services: # ── FastAPI backend ──────────────────────────────────────────────────────── backend: build: context: ./backend dockerfile: Dockerfile ports: - "8000:8000" env_file: - ./backend/.env environment: - PYTHONUNBUFFERED=1 - UVICORN_WORKERS=4 restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 15s timeout: 5s retries: 3 # ── Vite frontend (dev) ──────────────────────────────────────────────────── frontend: image: node:20-alpine working_dir: /app volumes: - ./frontend:/app ports: - "3000:3000" environment: - VITE_WS_URL=ws://backend:8000/ws command: sh -c "npm install && npm run dev" depends_on: - backend restart: unless-stopped # ── Nginx reverse proxy (production) ────────────────────────────────────── # Uncomment for production; proxies /ws → backend, / → frontend dist # nginx: # image: nginx:alpine # ports: # - "80:80" # volumes: # - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro # - ./frontend/dist:/usr/share/nginx/html:ro # depends_on: # - backend