version: "3.8" services: # PostgreSQL 数据库 db: image: postgres:16-alpine container_name: gpt-team-db restart: always environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: teamhelper volumes: - pgdata:/var/lib/postgresql/data healthcheck: test: [ "CMD-SHELL", "pg_isready -U postgres" ] interval: 5s timeout: 5s retries: 5 # Go Helper Bot bot: build: . container_name: gpt-team-bot restart: always depends_on: db: condition: service_healthy env_file: - .env environment: # 覆盖 .env 中的数据库连接串,指向 docker 内部的 db 服务 DATABASE_URL: postgres://postgres:postgres@db:5432/teamhelper?sslmode=disable volumes: pgdata: