Makefile: Generate purely-static binaries
By default, `go build` generates binaries which my be
dynamically-linked. This sometimes breaks portability, for example
when building a Go binary on Alpine and trying to run it on Ubuntu.
.PHONY: build
build:
- go build -o lokoctl github.com/kinvolk/lokoctl/cli
+ CGO_ENABLED=0 GOOS=linux go build -ldflags "-extldflags '-static'" \
+ -o lokoctl \
+ github.com/kinvolk/lokoctl/cli
.PHONY: test
test: check-go-format
