services: # PostgreSQL 数据库 postgres: image: postgres:16-alpine container_name: wawa-fg-postgres restart: unless-stopped environment: POSTGRES_DB: fg POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d fg"] interval: 10s timeout: 5s retries: 5 start_period: 10s networks: - wawa-network # Feature Gating 应用 app: build: context: . dockerfile: Dockerfile container_name: wawa-fg-app restart: unless-stopped ports: - "8000:8000" environment: # PostgreSQL 连接 DATABASE_URL: postgresql://postgres:postgres@postgres:5432/fg # 管理员账号(首次启动时创建) ADMIN_USERNAME: ${ADMIN_USERNAME:-admin} ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin} # JWT 配置(生产环境请修改) JWT_SECRET_KEY: ${JWT_SECRET_KEY:-change-me-in-production-jwt-secret} JWT_ALGORITHM: HS256 JWT_EXPIRE_MINUTES: 10080 # 7 days # Session 配置 SESSION_SECRET_KEY: ${SESSION_SECRET_KEY:-change-me-in-production-session-secret} # 缓存配置 CACHE_TTL_SECONDS: ${CACHE_TTL_SECONDS:-60} # 应用配置 APP_TITLE: ${APP_TITLE:-Feature Gating} depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()"] interval: 30s timeout: 10s retries: 3 start_period: 40s networks: - wawa-network volumes: postgres_data: driver: local networks: wawa-network: driver: bridge