version: "3.9" services: db: image: postgres:16-alpine restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-vpn} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-vpn_secret} POSTGRES_DB: ${POSTGRES_DB:-vpn_control} ports: - "5432:5432" volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U vpn"] interval: 5s timeout: 5s retries: 5 redis: image: redis:7-alpine restart: unless-stopped ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 5 app: build: context: . dockerfile: docker/Dockerfile restart: unless-stopped ports: - "${PORT:-8000}:8000" env_file: - .env depends_on: db: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8000/health"] interval: 30s timeout: 10s retries: 3 start_period: 15s volumes: pgdata: