# 构建 go 服务镜像 FROM golang:1.22.5-alpine3.20 as builder ARG GOPROXY ENV GOPROXY $GOPROXY ARG GOSUMDB ENV GOSUMDB $GOSUMDB WORKDIR /data/workspace COPY main.go go.mod go.sum ./ RUN go mod vendor RUN go build FROM debian:bookworm ENV TZ="Asia/Shanghai" WORKDIR /usr/local/app COPY --from=builder /data/workspace/helloworld /usr/local/app/helloworld CMD ["/usr/local/app/helloworld"]