diff --git a/.goreleaser.yml b/.goreleaser.yml index 50d9785e..ea50c98d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -20,7 +20,15 @@ builds: - CGO_ENABLED=0 binary: haproxy-ingress-controller id: my-build + flags: + # keeps the build path of the machine that produced the binary out of it + - -trimpath ldflags: + # drops the symbol table, and the DWARF data with it: the linker derives + # -w from -s unless -w is given explicitly. about 29 MB of the binary. + # the pclntab is untouched, so a panic still prints a stack trace with + # function names and line numbers, and pprof still symbolises. + - -s - -X "main.GitRepo={{.GitURL}}" - -X "main.GitTag={{.Tag}}" - -X "main.GitCommit={{.ShortCommit}}" diff --git a/build/Dockerfile b/build/Dockerfile index e9b3d8eb..0b7acff5 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -56,7 +56,8 @@ RUN mkdir -p /var/run/vars && \ cd /src && \ git describe --abbrev=0 --tags > /var/run/vars/GIT_LAST_TAG || echo "dev" > /var/run/vars/GIT_LAST_TAG && \ CGO_ENABLED=0 go build \ - -ldflags "-X github.com/haproxytech/kubernetes-ingress/pkg/version.GitTag=$(cat /var/run/vars/GIT_LAST_TAG)" \ + -trimpath \ + -ldflags "-s -X github.com/haproxytech/kubernetes-ingress/pkg/version.GitTag=$(cat /var/run/vars/GIT_LAST_TAG)" \ -o fs/haproxy-ingress-controller . FROM haproxytech/haproxy-alpine:3.2