Skip to content

Commit

Permalink
chore: compress binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Nov 26, 2020
1 parent 8541b76 commit bf8136f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
5 changes: 3 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ steps:
event:
- tag
commands:
- apk add git make
- apk add git make upx
- make build -j$(nproc)
- make compress -j$(nproc)

- name: Publish binaries to Github
image: plugins/github-release
Expand All @@ -43,6 +44,6 @@ steps:
- sha512
---
kind: signature
hmac: cf137f1b661efff57328c87c254c758fa27bcfb40f34b05c63975a680bea2ddf
hmac: dd6eebc7795bd809dd5cc006aa5a28b114e7b901b369f5a7a171e7f40431d565

...
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,30 @@ APP_VERSION := $(shell git tag | tail -1)
build: build_linux build_windows build_darwin ; @echo "Done building!"

build_linux: ; @\
GOOS=linux GOARCH=amd64 go build -mod vendor -ldflags "-X main.AppVersion=${APP_VERSION}" -o bin/gots_linux_amd64 cmd/gots/main.go && \
GOOS=linux GOARCH=amd64 go build -mod vendor -ldflags "-s -w -X main.AppVersion=${APP_VERSION}" -o bin/gots_linux_amd64 cmd/gots/main.go && \
chmod +x bin/gots_linux_amd64

build_windows: ; @\
GOOS=windows GOARCH=amd64 go build -mod vendor -ldflags "-X main.AppVersion=${APP_VERSION}" -o bin/gots_windows_amd64.exe cmd/gots/main.go
GOOS=windows GOARCH=amd64 go build -mod vendor -ldflags "-s -w -X main.AppVersion=${APP_VERSION}" -o bin/gots_windows_amd64.exe cmd/gots/main.go

build_darwin: ; @\
GOOS=darwin GOARCH=amd64 go build -mod vendor -ldflags "-X main.AppVersion=${APP_VERSION}" -o bin/gots_darwin_amd64 cmd/gots/main.go && \
GOOS=darwin GOARCH=amd64 go build -mod vendor -ldflags "-s -w -X main.AppVersion=${APP_VERSION}" -o bin/gots_darwin_amd64 cmd/gots/main.go && \
chmod +x bin/gots_darwin_amd64

.PHONY: compress
compress: compress_linux compress_windows compress_darwin ; @echo "Done compressing binaries"

compress_linux:
@ upx -qqq bin/gots_linux_amd64

compress_windows:
@ upx -qqq bin/gots_windows_amd64.exe

compress_darwin:
@ upx -qqq bin/gots_darwin_amd64

docker_build: ; @\
docker build -t harbor.zyra.ca/public/gots .

docker_push: ; @\
docker push harbor.zyra.ca/public/gots
docker push harbor.zyra.ca/public/gots

0 comments on commit bf8136f

Please sign in to comment.