From 6953e8bbbf84ffa8757901d6ea7426ed076711c9 Mon Sep 17 00:00:00 2001 From: lab Date: Wed, 31 Jul 2024 11:55:12 +0800 Subject: [PATCH] feat: add upx to compress go app --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 858785f..142beb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ADD . ./src WORKDIR /go/src RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \ - && apk --no-cache add ca-certificates \ + && apk --no-cache add ca-certificates upx \ && go env -w GOPROXY='https://goproxy.cn,direct' \ && go mod tidy \ && CGO_ENABLED=0 GOOS="linux" GOARCH="amd64" \ @@ -14,7 +14,8 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositorie -tags timetzdata \ -v \ -o /app \ - ./cmd/cert-exporter + ./cmd/cert-exporter \ + && upx -9 /app FROM scratch as production