name: doodle-prod services: api: image: ${DOODLE_API_IMAGE:?请在 .env 中填写已导入的镜像标签} platform: linux/amd64 container_name: doodle-api-prod # raw 保留密码中的 $ 等字符,需要 Docker Compose >= 2.30.0。 env_file: - path: ./server.env format: raw init: true restart: unless-stopped stop_grace_period: 30s ports: - '127.0.0.1:8800:8800' networks: - panel healthcheck: # 同时验证 HTTP 和数据库连通性;不代表业务表、微信或七牛已验收。 test: - CMD - node - -e - "fetch('http://127.0.0.1:8800/api/v1/health/ready', { signal: AbortSignal.timeout(2500) }).then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" interval: 30s timeout: 5s retries: 3 start_period: 30s mem_limit: 768m security_opt: - no-new-privileges:true cap_drop: - ALL logging: driver: json-file options: max-size: '10m' max-file: '3' networks: panel: # 复用 1Panel 已有数据库网络,不创建或接管 PostgreSQL 容器。 external: true name: ${PANEL_DOCKER_NETWORK:-1panel-network}