# ────────────────────────────────────────────────────── # PRODUCTION — docker compose up # Requires: npm run docker:build (or make docker:build) # ────────────────────────────────────────────────────── name: citygame services: # ── Database ────────────────────────────────── db: image: postgres:16-alpine container_name: citygame-db restart: unless-stopped environment: POSTGRES_DB: ${DB_NAME:-citygame} POSTGRES_USER: ${DB_USERNAME:-citygame} POSTGRES_PASSWORD: ${DB_PASSWORD:-citygame} volumes: - pgdata:/var/lib/postgresql/data networks: - citygame-net healthcheck: test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-citygame} -d ${DB_NAME:-citygame}"] interval: 10s timeout: 5s retries: 5 start_period: 10s # ── Backend (Spring Boot) ───────────────────── backend: image: citygame-backend:latest container_name: citygame-backend restart: unless-stopped depends_on: db: condition: service_healthy environment: SPRING_PROFILES_ACTIVE: prod DB_URL: jdbc:postgresql://db:5432/${DB_NAME:-citygame} DB_USERNAME: ${DB_USERNAME:-citygame} DB_PASSWORD: ${DB_PASSWORD:-citygame} CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost} JAVA_TOOL_OPTIONS: "-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0" ports: - "${BACKEND_PORT:-8080}:8080" networks: - citygame-net healthcheck: test: ["CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health || exit 1"] interval: 30s timeout: 10s retries: 3 start_period: 30s # ── Frontend (nginx) ────────────────────────── frontend: image: citygame-frontend:latest container_name: citygame-frontend restart: unless-stopped depends_on: backend: condition: service_healthy ports: - "${FRONTEND_PORT:-80}:80" networks: - citygame-net volumes: pgdata: driver: local networks: citygame-net: driver: bridge