作者 yangfu

Dockerfile 构建修改

正在显示 1 个修改的文件 包含 2 行增加2 行删除
@@ -9,8 +9,8 @@ COPY ./main.go main.go @@ -9,8 +9,8 @@ COPY ./main.go main.go
9 # RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 9 # RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]
10 ENV GO111MODULE on 10 ENV GO111MODULE on
11 ENV GOPROXY https://goproxy.cn,direct 11 ENV GOPROXY https://goproxy.cn,direct
12 -RUN ["go","mod","tidy"]  
13 -RUN ["go","build"] 12 +RUN go mod tidy
  13 +RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -o godevp .
14 14
15 FROM alpine:latest 15 FROM alpine:latest
16 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] 16 RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"]