Skip to content

Consider removing the symbol tables from builds to reduce the binary size #325

Description

@maggie44

Really interesting digging around and learning about balena-engine.

I wonder if it would be worth removing the symbol tables (https://medium.com/a-journey-with-go/go-how-to-take-advantage-of-the-symbols-table-360dd52269e5) to reduce the binary size further? It is fairly common to remove in production when debugging tools are not required.

A quick test suggests it reduces the binary size 14%.

Ideally we wouldn't want to change the code base from Moby that could create more merge commits for us. Instead, it looks like there is an option to pass in ldflags via environment variables (DOCKER_LDFLAGS).

If also seems though that it is a broken feature. I raised a PR with Moby who seem to have fixed it in the latest: moby/moby#44729 (comment)

Perhaps it is something to consider when we merge the latest Moby and resolve the flags issue, or if there are other ideas for implementation, so logging here for reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions