services: db: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: pgames POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pgames} POSTGRES_DB: pgames volumes: - db:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U pgames"] interval: 5s retries: 20 backend: build: ./backend restart: unless-stopped env_file: .env environment: DATABASE_URL: postgresql+asyncpg://pgames:${POSTGRES_PASSWORD:-pgames}@db:5432/pgames DATA_DIR: /data volumes: - ${DATA_PATH:-./data}:/data healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"] interval: 5s retries: 30 depends_on: db: condition: service_healthy worker: build: ./backend restart: unless-stopped command: ["python", "-m", "app.worker"] env_file: .env environment: DATABASE_URL: postgresql+asyncpg://pgames:${POSTGRES_PASSWORD:-pgames}@db:5432/pgames DATA_DIR: /data volumes: - ${DATA_PATH:-./data}:/data depends_on: backend: condition: service_healthy # migrations are applied by backend web: build: ./frontend restart: unless-stopped ports: - "${HTTP_PORT:-8080}:80" volumes: - ${DATA_PATH:-./data}:/data:ro depends_on: - backend volumes: db: