2021-12-05 00:41:44 +08:00
|
|
|
FROM golang:alpine as builder
|
|
|
|
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
ENV GOOS="linux"
|
|
|
|
ENV GOARCH="amd64"
|
|
|
|
|
2021-12-05 00:56:32 +08:00
|
|
|
ADD ./ /src
|
|
|
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
2021-12-05 00:41:44 +08:00
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
RUN go build -ldflags="-s -w" -tags timetzdata -o app main.go
|
|
|
|
|
|
|
|
FROM scratch as production
|
|
|
|
|
|
|
|
ENV TZ="Asia/Shanghai"
|
|
|
|
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2021-12-05 00:56:32 +08:00
|
|
|
COPY --from=builder /src/app .
|
2021-12-05 00:41:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
CMD ["./app"]
|