go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.75k stars 5.47k forks source link

Strip release binaries to reduce download size #7827

Open ghost opened 5 years ago

ghost commented 5 years ago

Just running strip command on the binaries from https://dl.gitea.io/gitea/1.9.0/ reduces the compressed size of Gitea binaries for 64-bit Linux by 10 megabytes, which is almost 30% of the original size:

$ curl -sSf https://dl.gitea.io/gitea/1.9.0/gitea-1.9.0-linux-amd64.xz | xz -d > gitea-1.9.0-linux-amd64
$ xz -k -9 < gitea-1.9.0-linux-amd64 | wc -c
35780080
$ strip gitea-1.9.0-linux-amd64 
$ xz -k -9 < gitea-1.9.0-linux-amd64 | wc -c
25514852

So it might be a good idea to add stripping for the binaries as a build step in CI release script for all platforms that support it.

silverwind commented 5 years ago

Relevant: https://blog.filippo.io/shrink-your-go-binaries-with-this-one-weird-trick/