2021-07-07 15:19:09 +08:00
|
|
|
FROM --platform=$TARGETPLATFORM golang:1.16.5-alpine3.13 as gobuilder
|
|
|
|
|
|
|
|
ENV GO111MODULE="on"
|
|
|
|
ENV GOPROXY="https://goproxy.cn,direct"
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
|
|
|
|
WORKDIR /go/src/app
|
|
|
|
COPY . .
|
|
|
|
|
2021-08-25 17:07:23 +08:00
|
|
|
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
2021-07-07 15:19:09 +08:00
|
|
|
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
|
|
|
|
RUN update-ca-certificates
|
|
|
|
RUN go build
|
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
|
|
|
|
WORKDIR /root
|
|
|
|
|
|
|
|
COPY --from=gobuilder /go/src/app/wecomchan .
|
|
|
|
COPY --from=gobuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
CMD ["./wecomchan"]
|