FROM golang as build
# 设置 Proxy
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct
RUN curl -ik https://goproxy.cn/golang.org/x/text/@latest
ADD . /pilipili
WORKDIR /pilipili
RUN go mod tidy
# 交叉编译
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o api_server参考资料:https://github.com/goproxy/goproxy.cn/issues/148