From 6b9f295167aa9dced00a4aa4a9150051a034b748 Mon Sep 17 00:00:00 2001 From: "Yoan.liu" Date: Fri, 23 May 2025 16:48:41 +0800 Subject: [PATCH] update Dockerfile --- Dockerfile | 3 ++- Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7fcf6ae5..80de362b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,8 @@ WORKDIR /app COPY ../. /app/ RUN rm -rf /app/ui/dist COPY --from=webui-builder /app/ui/dist /app/ui/dist -RUN go build -o certimate +ENV CGO_ENABLED=0 +RUN go build -ldflags="-s -w" -o certimate diff --git a/Makefile b/Makefile index 7bf8cabd..eb05c306 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,8 @@ $(OS_ARCH): @mkdir -p $(BUILD_DIR) GOOS=$(word 1,$(subst /, ,$@)) \ GOARCH=$(word 2,$(subst /, ,$@)) \ - go build -o $(BUILD_DIR)/$(BINARY_NAME)_$(word 1,$(subst /, ,$@))_$(word 2,$(subst /, ,$@)) -ldflags="-X main.version=$(VERSION)" . + CGO_ENABLED=0 \ + go build -o $(BUILD_DIR)/$(BINARY_NAME)_$(word 1,$(subst /, ,$@))_$(word 2,$(subst /, ,$@)) -ldflags="-X main.version=$(VERSION) -s -w" . # 清理构建文件 clean: