Makefile 888 B

12345678910111213141516171819202122232425
  1. build:
  2. go build -ldflags="-s -w" goctl.go
  3. $(if $(shell command -v upx), upx goctl)
  4. mac:
  5. GOOS=darwin go build -ldflags="-s -w" -o goctl-darwin goctl.go
  6. $(if $(shell command -v upx), upx goctl-darwin)
  7. win:
  8. GOOS=windows go build -ldflags="-s -w" -o goctl.exe goctl.go
  9. $(if $(shell command -v upx), upx goctl.exe)
  10. linux:
  11. GOOS=linux go build -ldflags="-s -w" -o goctl-linux goctl.go
  12. $(if $(shell command -v upx), upx goctl-linux)
  13. image:
  14. docker build --rm --platform linux/amd64 -t kevinwan/goctl:$(version) .
  15. docker tag kevinwan/goctl:$(version) kevinwan/goctl:latest
  16. docker push kevinwan/goctl:$(version)
  17. docker push kevinwan/goctl:latest
  18. docker build --rm --platform linux/arm64 -t kevinwan/goctl:$(version)-arm64 .
  19. docker tag kevinwan/goctl:$(version)-arm64 kevinwan/goctl:latest-arm64
  20. docker push kevinwan/goctl:$(version)-arm64
  21. docker push kevinwan/goctl:latest-arm64