hashicorp / hashicorp/consul

Shrink the binary

Open
#9,074 1 comment 2 reactions 0 assignees View on GitHub
theme/internal-cleanup theme/internals type/enhancement
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

If there is ever a need to run Consul in an environment where storage space is limited we can shrink the binary from its current size (~107Mb) to roughly 15Mb with a few small changes.

* with `-ldflags="-s -w"` flags reduces the size to 78Mb
* with [this diff to remove `go-discover` and the bindata for the UI](https://github.com/hashicorp/consul/compare/dnephin/deprecate-go-discover) using the `-tags=tiny` build flag reduces the size to 49Mb
* with [upx](https://upx.github.io/) compression reduces the size to 15Mb

With additional flags on `upx` that size may be reduced further. These sizes were on `linux/amd64`, I'm not sure how much different that would be for arm.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.