From ffc776fa47d6e689531bf981b77428ff670b4ae8 Mon Sep 17 00:00:00 2001 From: Krishna Kala Date: Thu, 10 Sep 2026 07:06:14 +0000 Subject: [PATCH] chore: strip debug symbols from binary to reduce image size Adds -s -w to the existing ldflags in the build target. The binary carried 721,193 symbols and eleven .debug_* sections, accounting for 77.6 MB of its 277 MB size. Binary: 277,213,440 B to 199,579,560 B (-28.0%) Image: 462 MB to 385 MB (-16.7%) The -X injections for GitCommit, BuildTime and ServerMode are unaffected, as they write to the data section rather than .symtab. Verified by extracting the injected build timestamp from the stripped binary with strings. Closes #2539 Signed-off-by: Krishna Kala --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 354aeb4011..f1902390de 100755 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ export build: clean wire $(ENVVAR) GOOS=$(GOOS) go build -o devtron \ - -ldflags="-X 'github.com/devtron-labs/devtron/util.GitCommit=${GIT_COMMIT}' \ + -ldflags="-s -w -X 'github.com/devtron-labs/devtron/util.GitCommit=${GIT_COMMIT}' \ -X 'github.com/devtron-labs/devtron/util.BuildTime=${BUILD_TIME}' \ -X 'github.com/devtron-labs/devtron/util.ServerMode=${SERVER_MODE_FULL}'"