feat(release): strip binary to reduce size

This commit is contained in:
Allisson Azevedo 2020-10-10 12:05:32 -03:00
parent 3d14d42356
commit d3da40e0ad

View File

@ -1,4 +1,4 @@
TARGETS = darwin/amd64 darwin/386 linux/amd64 linux/386 windows/amd64 windows/386 TARGETS = darwin/amd64 linux/amd64 linux/386 windows/amd64 windows/386
GIT_COMMIT = $(shell git rev-parse HEAD) GIT_COMMIT = $(shell git rev-parse HEAD)
BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n') BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
GO_VERSION = $(shell go version | awk {'print $$3'}) GO_VERSION = $(shell go version | awk {'print $$3'})
@ -50,12 +50,12 @@ release: clean assets
@echo "Building binaries..." @echo "Building binaries..."
@gox \ @gox \
-osarch "$(TARGETS)" \ -osarch "$(TARGETS)" \
-ldflags "-X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \ -ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
-output "./bin/pgweb_{{.OS}}_{{.Arch}}" -output "./bin/pgweb_{{.OS}}_{{.Arch}}"
@echo "Building ARM binaries..." @echo "Building ARM binaries..."
GOOS=linux GOARCH=arm GOARM=5 go build \ GOOS=linux GOARCH=arm GOARM=5 go build \
-ldflags "-X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \ -ldflags "-s -w -X github.com/sosedoff/pgweb/pkg/command.GitCommit=$(GIT_COMMIT) -X github.com/sosedoff/pgweb/pkg/command.BuildTime=$(BUILD_TIME) -X github.com/sosedoff/pgweb/pkg/command.GoVersion=$(GO_VERSION)" \
-o "./bin/pgweb_linux_arm_v5" -o "./bin/pgweb_linux_arm_v5"
@echo "\nPackaging binaries...\n" @echo "\nPackaging binaries...\n"