change Dockerfile增加包管理代理环境变量

main
dugulp 2024-08-01 02:23:42 +08:00
parent b75050914d
commit 379864e383
1 changed files with 4 additions and 4 deletions

View File

@ -7,16 +7,16 @@ WORKDIR /app
# 复制 go mod 和 sum 文件
COPY go.mod go.sum ./
# 设置环境变量
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.io,direct
# 下载依赖
RUN go mod download
# 复制源代码
COPY . .
# 设置环境变量
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.io,direct
# 构建应用
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .