Files
eightbf-analysis-go/Dockerfile
T
gozerosandCursor bd427b57a1 feat: 换到 Gin 主流栈并补齐运维能力
HTTP 用 Gin,配置用 Viper,日志用 zap,数据用 sqlx;保留原有接口与会商行为。
顺带补上就绪探活、请求号、滚动日志、systemd 与 Dockerfile。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-04 09:51:41 +08:00

22 lines
755 B
Docker

# 多阶段构建:产出可直接跑的静态风格二进制(仍动态链接 libc 即可)
FROM golang:1.23-bookworm AS build
WORKDIR /src
ENV GOPROXY=https://goproxy.cn,direct
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /out/eightbf-analysis-go ./cmd/server
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app /var/log/eightbf-analysis
WORKDIR /app
COPY --from=build /out/eightbf-analysis-go /app/eightbf-analysis-go
COPY schema.sql /app/schema.sql
ENV EBA_SCHEMA_PATH=/app/schema.sql \
SERVER_PORT=18097 \
LOG_LEVEL=info
EXPOSE 18097
ENTRYPOINT ["/app/eightbf-analysis-go"]