Don't use static compilation for non-release builds (it makes the CI really slow)

This commit is contained in:
Alessio 2024-05-29 22:21:13 -07:00
parent d45edcf08c
commit 971bef06e5

View File

@ -3,13 +3,15 @@
set -x
set -e
export CGO_ENABLED=1
export CC=musl-gcc
FLAGS="-s -w -linkmode=external -extldflags=-static -X gitlab.com/offline-twitter/twitter_offline_engine/internal/webserver.use_embedded=true"
# General build flags
FLAGS="-s -w -X gitlab.com/offline-twitter/twitter_offline_engine/internal/webserver.use_embedded=true"
if [[ -n "$1" ]]; then
go build -ldflags="$FLAGS -X main.version_string=$1" -o tw ./twitter
# Static build params
export CGO_ENABLED=1
export CC=musl-gcc
SPECIAL_FLAGS_FOR_STATIC_BUILD="-linkmode=external -extldflags=-static"
go build -ldflags="$FLAGS $SPECIAL_FLAGS_FOR_STATIC_BUILD -X main.version_string=$1" -o tw ./twitter
else
go build -ldflags="$FLAGS" -o tw ./twitter
fi