Press "Enter" to skip to content

go安装依赖设置代理

使用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

参考资料:https://github.com/goproxy/goproxy.cn/issues/148

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注