Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerfile: trim GCC installation by 52 MB (#66)
This commit reduces our image size by about 50 MB by deleting some large, unnecessary files. Image size before this commit: 139.68 MB Image size with this commit: 87.48 MB The majority of the image size comes from the GCC installation, but we don't need things like LTO support or the D standard library in our image. Therefore this commit removes these large files: 21.5M /usr/libexec/gcc/x86_64-alpine-linux-musl/10.2.1/lto1 21.5M /usr/bin/lto-dump 5.8M /usr/lib/libgphobos.so.1.0.0 976.0K /usr/libexec/gcc/x86_64-alpine-linux-musl/10.2.1/lto-wrapper The largest remaining files in the image: $ find / -type f -exec du -k {} + | sort -nr | head -n20 | cut -f2 | xargs du -sh 22.4M /usr/libexec/gcc/x86_64-alpine-linux-musl/10.2.1/cc1 9.4M /usr/lib/libc.a 4.6M /nim/bin/nim 2.9M /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/libgcc.a 2.6M /usr/lib/libmpfr.so.6.1.0 2.5M /lib/libcrypto.so.1.1 1.6M /usr/lib/libstdc++.so.6.0.28 1.6M /usr/lib/libisl.so.22.0.0 1.6M /usr/bin/ld 1.5M /usr/bin/dwp 1.3M /usr/lib/libopcodes-2.35.2.so 1.2M /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/plugin/gtype.state 1.1M /usr/lib/libgdruntime.so.1.0.0 1.1M /usr/lib/libbfd-2.35.2.so 1.1M /usr/bin/gcc 1.1M /usr/bin/cpp 952.0K /usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/plugin/include/insn-flags.h 808.0K /bin/busybox 604.0K /usr/bin/as 592.0K /lib/ld-musl-x86_64.so.1 The final disk usage in the root directory: $ du -k -d1 / | sort -nr | cut -f2 | xargs du -sh 87.9M / 67.6M /usr 9.9M /nim 3.9M /lib 1.1M /bin 428.0K /etc 324.0K /sbin 12.0K /var 0 /tmp 0 /srv 0 /run 0 /root 0 /opt 0 /mnt 0 /media 0 /home Note that: - The `busybox` `sort` available in the image from doesn't have the `-h` option, hence the above convoluted piping. - We can't delete the files by force-removing dependencies of the `gcc` package. That is, something like `apk del --force libgphobos` doesn't work.
- Loading branch information