Improved build script (#152)

- explicity disable cgo
- ensure static builds
- reduce binary size
- small formatting changes

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
kim 2021-08-26 11:19:52 +01:00 committed by GitHub
parent ddc120d5e6
commit 03479312f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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