Files
yuxuanhui 3a8b608449
Deploy backend / deploy (push) Failing after 3m1s
feat: 更新 Dockerfile,添加 GOPROXY 环境变量
2026-09-29 19:28:22 +08:00

16 lines
410 B
Docker

FROM golang:1.26-alpine AS builder
WORKDIR /src
COPY go.mod go.sum ./
ENV GOPROXY=https://goproxy.cn
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/api ./cmd/server
FROM alpine:3.23
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /out/api /usr/local/bin/api
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/api"]