goreleaser / goreleaser-cross

Docker image for Golang cross-compiling with CGO
MIT License
146 stars 25 forks source link

Add upx tool #14

Closed bhuisgen closed 1 year ago

bhuisgen commented 1 year ago

Add upx tool to compress binary & docker images.

To enable it, add a post hook to your goreleaser build:

builds:
  - hooks:
      post:
        - upx "{{.Path}}"
troian commented 1 year ago

thanks @bhuisgen, does it compress docker images? I thought it only does binaries

bhuisgen commented 1 year ago

Only the binaries files are compressed with upx. Normally images compression is done by docker push before uploading and it depends of the registry too (the docker DTR did it). If you execute a docker save command on your image, it will be compressed like a tarball. I will probably do this by filtering artifacts.json after goreleaser execution.

caarlos0 commented 1 year ago

fwiw, if you compress the binary with upx, and your docker image just copies your binary somewhere, then there won't be much more to compress I think...

troian commented 1 year ago

i think the best would be to just install upx any time it will be used.