Skip to content

Size optimizations #448

Closed
Closed
@lubo

Description

@lubo

Hi. I've come across a couple of size optimizations, which may sound interesting. By default, Alpine Linux builds packages with -Os GCC flag, which optimizes compiled binaries for size. By setting CFLAGS="-Os", I was able to reduce size of 3.8-alpine3.11 image from 112 MB to 83.9 MB (25% smaller). Also, Alpine Linux runs strip on all compiled binaries. AFAIK we can imitate that by setting LDFLAGS="-Wl,--strip-all", which strips all symbols from compiled binaries. After setting it, the image size was further reduced to 67.3 MB (40% smaller). Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    RequestRequest for image modification or feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions