Skip to content

Commit

Permalink
build static binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
shihyuho committed Sep 11, 2018
1 parent ef7a0c3 commit 57413b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,17 @@ test:
build:
go build -o $(BUILD)/$(BINARY) -ldflags $(LDFLAGS)

# build static binaries: https://medium.com/@diogok/on-golang-static-binaries-cross-compiling-and-plugins-1aed33499671
.PHONY: dist
dist:
mkdir -p $(BUILD)
mkdir -p $(DIST)
cp README.md $(BUILD) && cp LICENSE $(BUILD) && sed -E 's/(version: )"(.+)"/\1"$(VERSION)"/g' plugin.yaml > $(BUILD)/plugin.yaml
GOOS=linux GOARCH=amd64 go build -o $(BUILD)/$(BINARY) -ldflags $(LDFLAGS) -a -tags netgo
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $(BUILD)/$(BINARY) -ldflags $(LDFLAGS) -a -tags netgo
tar -C $(BUILD) -zcvf $(DIST)/helm-$(BINARY)-linux-$(VERSION).tgz $(BINARY) README.md LICENSE plugin.yaml
GOOS=darwin GOARCH=amd64 go build -o $(BUILD)/$(BINARY) -ldflags $(LDFLAGS) -a -tags netgo
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $(BUILD)/$(BINARY) -ldflags $(LDFLAGS) -a -tags netgo
tar -C $(BUILD) -zcvf $(DIST)/helm-$(BINARY)-macos-$(VERSION).tgz $(BINARY) README.md LICENSE plugin.yaml
GOOS=windows GOARCH=amd64 go build -o $(BUILD)/$(BINARY).exe -ldflags $(LDFLAGS) -a -tags netgo
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o $(BUILD)/$(BINARY).exe -ldflags $(LDFLAGS) -a -tags netgo
tar -C $(BUILD) -llzcvf $(DIST)/helm-$(BINARY)-windows-$(VERSION).tgz $(BINARY).exe README.md LICENSE plugin.yaml

.PHONY: bootstrap
Expand Down

0 comments on commit 57413b5

Please sign in to comment.