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: 添加完整的数据库环境变量
55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
api:
|
|
image: registry.boss160.cn/junhong/cmp-fiber-api:latest
|
|
container_name: junhong-cmp-api
|
|
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
|
|
networks:
|
|
- junhong-network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
|
|
interval: 30s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 10s
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
worker:
|
|
image: registry.boss160.cn/junhong/cmp-fiber-worker:latest
|
|
container_name: junhong-cmp-worker
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./configs:/app/configs:ro
|
|
- ./logs:/app/logs
|
|
networks:
|
|
- junhong-network
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
networks:
|
|
junhong-network:
|
|
driver: bridge
|