commit 03479312f1772f52ffc758b6997317112a6b1d3c parent ddc120d5e6e0f18f235a6b5bbe5ceec86efedc41 Author: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 26 Aug 2021 11:19:52 +0100 Improved build script (#152) - explicity disable cgo - ensure static builds - reduce binary size - small formatting changes Signed-off-by: kim (grufwub) <grufwub@gmail.com> Diffstat:
M | build.sh | | | 9 | ++++++--- |
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/build.sh b/build.sh @@ -2,7 +2,10 @@ set -eu -export COMMIT=$(git rev-list -1 HEAD) -export VERSION=$(cat ./version) +COMMIT=$(git rev-list -1 HEAD) +VERSION=$(cat ./version) -go build -ldflags="-X 'main.Commit=$COMMIT' -X 'main.Version=$VERSION'" ./cmd/gotosocial +CGO_ENABLED=0 go build -trimpath \ + -tags 'netgo osusergo static_build' \ + -ldflags="-s -w -extldflags '-static' -X 'main.Commit=${COMMIT}' -X 'main.Version=${VERSION}'" \ + ./cmd/gotosocial