Vendor packages and add Makefile
* Vendors packages * Adds a Makefile that uses docker to build a static binary against musl using alpine linux. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
0a17578798
commit
bbbe67bf7c
1763 changed files with 755342 additions and 5 deletions
20
scripts/build-static.sh
Normal file
20
scripts/build-static.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
GARM_SOURCE="/build/garm"
|
||||
BIN_DIR="$GARM_SOURCE/bin"
|
||||
git config --global --add safe.directory "$GARM_SOURCE"
|
||||
|
||||
[ ! -d "$BIN_DIR" ] && mkdir -p "$BIN_DIR"
|
||||
|
||||
export CGO_ENABLED=1
|
||||
USER_ID=${USER_ID:-$UID}
|
||||
USER_GROUP=${USER_GROUP:-$(id -g)}
|
||||
|
||||
cd $GARM_SOURCE/cmd/garm
|
||||
go build -mod vendor -o $BIN_DIR/garm -tags osusergo,netgo,sqlite_omit_load_extension -ldflags "-linkmode external -extldflags '-static' -s -w -X main.Version=$(git describe --always --dirty)" .
|
||||
|
||||
cd $GARM_SOURCE/cmd/garm-cli
|
||||
go build -mod vendor -o $BIN_DIR/garm-cli -tags osusergo,netgo -ldflags "-linkmode external -extldflags '-static' -s -w -X garm/cmd/garm-cli/cmd.Version=$(git describe --always --dirty)" .
|
||||
GOOS=windows CGO_ENABLED=0 go build -mod vendor -o $BIN_DIR/garm-cli.exe -ldflags "-s -w -X garm/cmd/garm-cli/cmd.Version=$(git describe --always --dirty)" .
|
||||
|
||||
chown $USER_ID:$USER_GROUP -R "$BIN_DIR"
|
||||
Loading…
Add table
Add a link
Reference in a new issue