Files
codeapi/Dockerfile
2025-09-28 13:47:30 +08:00

19 lines
444 B
Docker

FROM golang:1.23-alpine AS builder
ARG CGO_ENABLED=0
WORKDIR /app
COPY go.mod go.sum ./
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod download
COPY main.go ./
RUN go build -o api
FROM alpine:3.20 AS certs
RUN apk add --no-cache ca-certificates
FROM scratch
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /app/api /api
ENTRYPOINT ["/api"]