Skip to content

Remove gcc and g++ from Alpine image #213

@franz-josef-kaiser

Description

@franz-josef-kaiser

Both libraries add a lot of unnecessary bloat image size wise. From looking at what packages have >10MB in size, those are the most "heavy" packages while being just a dependency needed during build time.

apk info -a \
    | uniq -u \
    | xargs -r apk info -s \
    | awk '/[\w\d\-\.]*[[:space:]]installed[[:space:]]size\:/{name=$1;next} /^[0-9]+$/{size=$1} { if ( 10 < (size / 1024 / 1024) ) printf " %2.0f MB | %s\n", ( size / 1024 / 1024 ), name }' \
    | sort -u

which results in the following list:

 11 MB | musl-dev-1.1.12-r2
 28 MB | icu-libs-56.1-r0
 43 MB | perl-5.22.1-r0
 62 MB | gcc-5.3.0-r0
 66 MB | g++-5.3.0-r0

The package currently has 343 MB according to ImageLayers.io for Alpine PHP FPM 5.6. Removing those two only, would save 131 MB … or 1/3rd of the size. Everyone can easily add (and again remove) those build-only dependencies in images if using this one as base image. And "just for convenience" does not justify the size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions