Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip all debug symbols from Go binaries by default #6035

Conversation

antoninbas
Copy link
Contributor

This reduces binary sizes by around 30%, which in turn reduces the size of Antrea container images.

If by any chance someone needs to create a binary / image with debug symbols, they should edit LDFLAGS / GOFLAGS in the Makefile directly.

We also remove system paths from binaries using the "-trimpath" Go flag, which is best practice when shipping Go binaries.

For #5883

This reduces binary sizes by around 30%, which in turn reduces the size
of Antrea container images.

If by any chance someone needs to create a binary / image with debug
symbols, they should edit LDFLAGS / GOFLAGS in the Makefile directly.

We also remove system paths from binaries using the "-trimpath" Go flag,
which is best practice when shipping Go binaries.

For antrea-io#5883

Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
@antoninbas antoninbas requested a review from tnqn February 29, 2024 03:39
@antoninbas
Copy link
Contributor Author

Uncompressed image sizes before the change:

antrea/antrea-ubuntu                          latest                      b8f89a3811d5   50 seconds ago       757MB
antrea/antrea-ubuntu                          v2.0.0-dev-d3a0e72c         b8f89a3811d5   50 seconds ago       757MB
antrea/antrea-agent-ubuntu                    latest                      033b6ecfb7bb   About a minute ago   415MB
antrea/antrea-agent-ubuntu                    v2.0.0-dev-d3a0e72c         033b6ecfb7bb   About a minute ago   415MB
antrea/antrea-controller-ubuntu               latest                      48844281ba7f   About a minute ago   251MB
antrea/antrea-controller-ubuntu               v2.0.0-dev-d3a0e72c         48844281ba7f   About a minute ago   251MB

And after the change:

antrea/antrea-ubuntu                          latest                      3d94db6d548e   7 minutes ago    664MB
antrea/antrea-ubuntu                          v2.0.0-dev-d3a0e72c.dirty   3d94db6d548e   7 minutes ago    664MB
antrea/antrea-agent-ubuntu                    latest                      31339c51ffbe   7 minutes ago    350MB
antrea/antrea-agent-ubuntu                    v2.0.0-dev-d3a0e72c.dirty   31339c51ffbe   7 minutes ago    350MB
antrea/antrea-controller-ubuntu               latest                      b940ba06c302   7 minutes ago    197MB
antrea/antrea-controller-ubuntu               v2.0.0-dev-d3a0e72c.dirty   b940ba06c302   7 minutes ago    197MB

Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, fantastic improvement!

@tnqn tnqn added the action/release-note Indicates a PR that should be included in release notes. label Feb 29, 2024
@antoninbas
Copy link
Contributor Author

/test-all

@tnqn tnqn merged commit d28e282 into antrea-io:main Feb 29, 2024
50 of 55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants