Closed pwFoo closed 2 years ago
You could use the below steps to create a custom version of gonit:
$> mkdir build
$> cd build
$> git clone https://github.com/bitnami/gonit.git
$> cd gonit
$> docker run -it -v $(pwd):/go/src/github.com/bitnami/gonit -w /go/src/github.com/bitnami/gonit/ golang:1.14.13-alpine3.11 sh
#> apk add git
#> go get ./...
#> go build -ldflags '-d -s -w' -tags netgo -installsuffix netgo .
That will create the static binary.
If you want to reduce its size, you could try compressing it with upx:
#> apk add upx
#> upx --ultra-brute gonit
The binary release isn't static and fails with a custom minimal alpine linux?
And binary size is big with 8,5MB? Is it possible to build a shrinked and static binary?