Files
Agent-System/deploy/app/Dockerfile
T
WeiCHENandCursor 8abf190e75 chore(deploy): 三环境 Compose 构建真实 app 镜像并补齐法规库运维
将 dev/test/main 的 app 服务从占位容器改为 Dockerfile 多阶段构建,增加 healthcheck 与 .regulations 只读挂载;新增法规库备份/恢复脚本并同步 env-service 目录初始化与 gitignore。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 19:53:24 +08:00

35 lines
909 B
Docker

# =============================================================================
# Go API Server (agent-dev / agent-test / agent-main)
# =============================================================================
FROM golang:1.23-bookworm AS builder
ENV GOTOOLCHAIN=auto
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /server ./cmd/server
FROM debian:bookworm-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates curl; \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /server /app/server
ENV DATA_DIR=/app/data \
HTTP_HOST=0.0.0.0 \
HTTP_PORT=8080
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=5s --retries=6 \
CMD curl -fsS "http://127.0.0.1:${HTTP_PORT:-8080}/api/v1/health" || exit 1
ENTRYPOINT ["/app/server"]
CMD ["-env", "/dev/null"]