# Build stage FROM golang:1.23-alpine AS build ENV GOPROXY=https://goproxy.cn,direct WORKDIR /src COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 go build -o /out/server ./cmd/server # Runtime stage: scratch + ca-certs copied from the build image. # Used for deployments where gcr.io/distroless is not reachable. FROM scratch COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=build /out/server /server EXPOSE 8080 ENTRYPOINT ["/server"]