From 7ba826e7dd4994c9b20ba7012588311d0e0f722d Mon Sep 17 00:00:00 2001 From: Oliver Bristow Date: Tue, 17 Feb 2026 15:06:28 +0000 Subject: [PATCH 1/2] build: reduce release binary size --- .goreleaser.yml | 5 +++++ Dockerfile | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 396f02f..3473283 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,11 @@ builds: - env: - CGO_ENABLED=0 + flags: + - -trimpath + - -buildvcs=false + ldflags: + - -s -w -buildid= -X main.version={{ .Version }} goos: - linux - windows diff --git a/Dockerfile b/Dockerfile index 773c990..3997893 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ COPY . . ENV GOTOOLCHAIN=local RUN apk add --no-cache ca-certificates && \ - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-w' ./gitlab-ci-validate.go + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -buildvcs=false -tags netgo -ldflags '-s -w -buildid=' ./gitlab-ci-validate.go FROM scratch From f6eeeca24ad81c5fba7a82a825e7f7e19ad2eb09 Mon Sep 17 00:00:00 2001 From: Oliver Bristow Date: Tue, 17 Feb 2026 15:18:18 +0000 Subject: [PATCH 2/2] build: enable UPX max compression for linux releases --- .goreleaser.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 3473283..3c27bc9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -10,6 +10,13 @@ builds: - linux - windows - darwin +upx: + - enabled: true + compress: best + lzma: true + goos: + - linux + archives: - id: binary format: binary