使用go mod tidy拉取依赖时,概率失败,read: connection reset by peer
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