version: '3.8' services: postgres: image: postgres:15-alpine container_name: knowfoolery-postgres environment: POSTGRES_DB: knowfoolery POSTGRES_USER: knowfoolery POSTGRES_PASSWORD: dev-password-2024 POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C" ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data - ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql healthcheck: test: ["CMD-SHELL", "pg_isready -U knowfoolery -d knowfoolery"] interval: 10s timeout: 5s retries: 5 start_period: 30s restart: unless-stopped networks: - knowfoolery # Game Service game-service: build: context: ../../backend/services/game-service dockerfile: Dockerfile container_name: knowfoolery-game-service environment: - PORT=3001 - DATABASE_URL=postgres://knowfoolery:dev-password-2024@postgres:5432/knowfoolery?sslmode=disable ports: - "3001:3001" depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3001/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s restart: unless-stopped networks: - knowfoolery # Question Service question-service: build: context: ../../backend/services/question-service dockerfile: Dockerfile container_name: knowfoolery-question-service environment: - PORT=3002 - DATABASE_URL=postgres://knowfoolery:dev-password-2024@postgres:5432/knowfoolery?sslmode=disable ports: - "3002:3002" depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3002/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s restart: unless-stopped networks: - knowfoolery # Gateway Service gateway-service: build: context: ../../backend/services/gateway-service dockerfile: Dockerfile container_name: knowfoolery-gateway environment: - PORT=3000 - GAME_SERVICE_URL=http://game-service:3001 - QUESTION_SERVICE_URL=http://question-service:3002 ports: - "3000:3000" depends_on: - game-service - question-service healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] interval: 30s timeout: 10s retries: 3 start_period: 60s restart: unless-stopped networks: - knowfoolery volumes: postgres_data: driver: local networks: knowfoolery: driver: bridge