first
continuous-integration/drone/push Build was killed Details

master
NY 1 month ago
parent 9280f9eb92
commit 0bbe4879af

@ -7,12 +7,8 @@ WORKDIR /workspace
# 将代码复制到容器内(你也可以选择在构建过程中通过挂载代码)
COPY . .
# 设置 Go 模块缓存和构建缓存目录
ENV GOMODCACHE=/go/pkg/mod
ENV GOCACHE=/go/cache
# 执行 go mod tidy 来同步和清理模块依赖
RUN go mod tidy
RUN --mount=type=cache,target=/go/pkg/mod \ go mod tidy
# 编译可执行文件
RUN go build -o myapp -ldflags "-X main.RunMode=test -s -w"

Loading…
Cancel
Save