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: