build: isolate go module proxy setting

This commit is contained in:
dela
2026-05-24 21:50:22 +08:00
parent 6f4e7f04cc
commit 622ff1d317
5 changed files with 15 additions and 9 deletions

View File

@@ -230,7 +230,7 @@ grep -rn --include="*.go" "float64\|float32" internal/entity
- `.dockerignore` 必须排除 `.env``.env.*`,防止 `Dockerfile``COPY . .` 把 secrets 送进 build context / builder layer。
- app 容器内端口固定为 8080宿主机暴露端口只通过 `APP_HOST_PORT` 调整。不要在 compose 中用 `${APP_PORT}` 同时控制容器内监听和宿主机映射。
- app 必须等待 Postgres healthcheck 通过、migration init container 成功退出后再启动。
- Docker build 阶段必须显式传入 `GOPROXY` / HTTP(S) proxy build args`go mod download` 失败必须立刻失败,禁止 `go mod download || true`
- Docker build 阶段必须显式传入 `GO_MODULE_PROXY`(映射为 Dockerfile 内的 `GOPROXY`/ HTTP(S) proxy build args`go mod download` 失败必须立刻失败,禁止 `go mod download || true``GO_MODULE_PROXY` 只能填 Go module proxy`https://goproxy.cn,direct`),不能填本机 HTTP 代理地址。
**为什么**:这个服务虽然不接 Binance 私钥,但 DB 密码和代理凭据仍可能出现在 `.env`。同时 app 启动前若表不存在,会导致 collector/API 失败;端口变量混用会让健康检查和端口映射分叉。