修复 API 容器健康检查失败:统一端口配置并添加数据库环境变量
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 3m23s

问题1: 端口不一致
- Dockerfile.api 中 EXPOSE 和健康检查使用 8088
- config.yaml 中 API 实际监听 3000
- 健康检查失败导致容器 unhealthy

问题2: 缺少数据库环境变量
- entrypoint-api.sh 需要 DB_HOST、DB_USER 等环境变量执行迁移
- docker-compose.prod.yml 没有定义这些变量
- 容器启动脚本立即退出

修复:
- Dockerfile.api: EXPOSE 和健康检查改为 3000
- docker-compose.prod.yml: 添加完整的数据库环境变量
This commit is contained in:
2026-01-20 11:33:26 +08:00
parent bf4ef37cc5
commit 286defb063
3 changed files with 458 additions and 2 deletions

View File

@@ -7,6 +7,13 @@ services:
restart: unless-stopped
ports:
- "3000:3000"
environment:
- DB_HOST=cxd.whcxd.cn
- DB_PORT=16159
- DB_USER=erp_pgsql
- DB_PASSWORD=erp_2025
- DB_NAME=junhong_cmp_test
- DB_SSLMODE=disable
volumes:
- ./configs:/app/configs:ro
- ./logs:/app/logs