# 第 5 层 Go I/O 型 MCP 工具(检索/入库/报告渲染等)。多阶段构建（上下文须为仓库根）：
#   docker build -f sundynix-mcp-go/Dockerfile -t sundynix/mcp-go .
FROM golang:1.25-alpine AS build
WORKDIR /src
COPY sundynix-shared/go.mod sundynix-shared/go.sum ./sundynix-shared/
COPY sundynix-mcp-go/go.mod sundynix-mcp-go/go.sum ./sundynix-mcp-go/
WORKDIR /src/sundynix-mcp-go
ENV GOWORK=off GOFLAGS=-mod=mod
RUN go mod download
WORKDIR /src
COPY sundynix-shared/ ./sundynix-shared/
COPY sundynix-mcp-go/ ./sundynix-mcp-go/
WORKDIR /src/sundynix-mcp-go
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/mcp-go ./cmd/server

FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/mcp-go /mcp-go
ENTRYPOINT ["/mcp-go"]
