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?
Hi. I've come across a couple of size optimizations, which may sound interesting. By default, Alpine Linux builds packages with
-OsGCC flag, which optimizes compiled binaries for size. By settingCFLAGS="-Os", I was able to reduce size of3.8-alpine3.11image from 112 MB to 83.9 MB (25% smaller). Also, Alpine Linux runsstripon all compiled binaries. AFAIK we can imitate that by settingLDFLAGS="-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?