From 98fd5b64fd9b1b94c4095ab911316746aafa7f61 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:32:08 +0000 Subject: [PATCH] Heroku-24: Remove gcc, make and libc6-dev from run image GCC was added to our run images back in #127 in order to support Ruby 2.6's then new MJIT feature: https://www.ruby-lang.org/en/news/2018/12/25/ruby-2-6-0-released/ However, since then: - The Ruby MJIT feature hasn't really resulted in significant performance benefits for real world use-cases like a Rails app. - Ruby's MJIT has since been superseded by YJIT, which is faster and doesn't need GCC at runtime: https://shopify.engineering/yjit-just-in-time-compiler-cruby https://shopify.engineering/ruby-yjit-is-production-ready - The image size impact of including build tools in our run images has increased considerably (#127 quoted it as 84 MB, but measuring now it's 203 MB). - In a CNB world, image size is much more of a concern than in the S3 `.img` + slug model, so we need to be more selective over what packages we include. As such, this removes `gcc`, `make` and `libc6-dev` from the run image for a 203 MB saving (they are still present in the build image, hence zero changes to `installed-packages-*.txt` for that image). Richard (Ruby owner) has confirmed he's fine with this change. Note: I'm intentionally not adding `binutils` back (which was a transitive dependency), since its 15 MB cost is not worth it for the ~once a year platform operator debugging use-case. Before: ``` -----> Size breakdown... heroku/heroku:24 661MB heroku/heroku:24-build 1.13GB ``` After: ``` -----> Size breakdown... heroku/heroku:24 458MB heroku/heroku:24-build 1.13GB ``` Towards #266. GUS-W-15159536. --- heroku-24-build/setup.sh | 1 + heroku-24/installed-packages-amd64.txt | 38 -------------------------- heroku-24/installed-packages-arm64.txt | 37 ------------------------- heroku-24/setup.sh | 3 -- 4 files changed, 1 insertion(+), 78 deletions(-) diff --git a/heroku-24-build/setup.sh b/heroku-24-build/setup.sh index f51b4477..3fc34f01 100755 --- a/heroku-24-build/setup.sh +++ b/heroku-24-build/setup.sh @@ -8,6 +8,7 @@ packages=( autoconf automake bison + # Includes gcc, g++, make, patch, libc6-dev etc. build-essential cmake gettext diff --git a/heroku-24/installed-packages-amd64.txt b/heroku-24/installed-packages-amd64.txt index 2a689550..878f2fa4 100644 --- a/heroku-24/installed-packages-amd64.txt +++ b/heroku-24/installed-packages-amd64.txt @@ -9,18 +9,11 @@ bash bind9-dnsutils bind9-host bind9-libs -binutils -binutils-common -binutils-x86-64-linux-gnu bsdutils bzip2 ca-certificates ca-certificates-java coreutils -cpp -cpp-13 -cpp-13-x86-64-linux-gnu -cpp-x86-64-linux-gnu curl dash debconf @@ -37,12 +30,8 @@ fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono -gcc -gcc-13 gcc-13-base -gcc-13-x86-64-linux-gnu gcc-14-base -gcc-x86-64-linux-gnu geoip-database gettext-base gir1.2-freedesktop @@ -77,14 +66,11 @@ libapparmor1 libapt-pkg6.0 libarchive13 libargon2-1 -libasan8 libass9 libassuan0 -libatomic1 libattr1 libaudit-common libaudit1 -libbinutils libblkid1 libbpf1 libbrotli1 @@ -92,24 +78,18 @@ libbsd0 libbz2-1.0 libc-bin libc-client2007e -libc-dev-bin libc6 -libc6-dev libcairo-gobject2 libcairo2 libcap-ng0 libcap2 libcap2-bin libcbor0.10 -libcc1-0 libcfitsio10 libcgif0 libcom-err2 -libcrypt-dev libcrypt1 libcryptsetup12 -libctf-nobfd0 -libctf0 libcurl3-gnutls libcurl4 libdatrie1 @@ -140,7 +120,6 @@ libfido2-1 libfontconfig1 libfreetype6 libfribidi0 -libgcc-13-dev libgcc-s1 libgcrypt20 libgd3 @@ -156,7 +135,6 @@ libgnutls-openssl27 libgnutls30 libgomp1 libgpg-error0 -libgprofng0 libgraphite2-3 libgssapi-krb5-2 libharfbuzz-gobject0 @@ -168,15 +146,11 @@ libheif-plugin-dav1d libheif-plugin-libde265 libheif1 libhogweed6 -libhwasan0 libhwy1 libicu74 libidn2-0 libimagequant0 libimath-3-1-29 -libisl23 -libitm1 -libjansson4 libjbig0 libjpeg-turbo8 libjpeg8 @@ -193,7 +167,6 @@ libldap2 liblerc4 liblmdb0 liblqr-1-0 -liblsan0 libltdl7 liblz4-1 liblzf1 @@ -211,14 +184,11 @@ libmemcached11 libmnl0 libmount1 libmp3lame0 -libmpc3 -libmpfr6 libmysqlclient21 libncursesw6 libnettle8 libnghttp2-14 libnpth0 -libnsl-dev libnsl2 libnspr4 libnss3 @@ -252,7 +222,6 @@ libpsl5 libpython3-stdlib libpython3.12-minimal libpython3.12-stdlib -libquadmath0 librabbitmq4 libraw23 libreadline8 @@ -267,7 +236,6 @@ libselinux1 libsemanage-common libsemanage2 libsepol2 -libsframe1 libsharpyuv0 libsmartcols1 libsodium23 @@ -289,10 +257,7 @@ libtheora0 libtiff6 libtinfo6 libtirpc-common -libtirpc-dev libtirpc3 -libtsan2 -libubsan1 libudev1 libunibreak5 libunistring5 @@ -327,12 +292,10 @@ libxxhash0 libyaml-0-2 libzip4 libzstd1 -linux-libc-dev locales login logsave lsb-release -make mawk media-types mlock @@ -363,7 +326,6 @@ python3.12 python3.12-minimal readline-common rename -rpcsvc-proto rsync sed sensible-utils diff --git a/heroku-24/installed-packages-arm64.txt b/heroku-24/installed-packages-arm64.txt index cfb3f745..878f2fa4 100644 --- a/heroku-24/installed-packages-arm64.txt +++ b/heroku-24/installed-packages-arm64.txt @@ -9,18 +9,11 @@ bash bind9-dnsutils bind9-host bind9-libs -binutils -binutils-aarch64-linux-gnu -binutils-common bsdutils bzip2 ca-certificates ca-certificates-java coreutils -cpp -cpp-13 -cpp-13-aarch64-linux-gnu -cpp-aarch64-linux-gnu curl dash debconf @@ -37,12 +30,8 @@ fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono -gcc -gcc-13 -gcc-13-aarch64-linux-gnu gcc-13-base gcc-14-base -gcc-aarch64-linux-gnu geoip-database gettext-base gir1.2-freedesktop @@ -77,14 +66,11 @@ libapparmor1 libapt-pkg6.0 libarchive13 libargon2-1 -libasan8 libass9 libassuan0 -libatomic1 libattr1 libaudit-common libaudit1 -libbinutils libblkid1 libbpf1 libbrotli1 @@ -92,24 +78,18 @@ libbsd0 libbz2-1.0 libc-bin libc-client2007e -libc-dev-bin libc6 -libc6-dev libcairo-gobject2 libcairo2 libcap-ng0 libcap2 libcap2-bin libcbor0.10 -libcc1-0 libcfitsio10 libcgif0 libcom-err2 -libcrypt-dev libcrypt1 libcryptsetup12 -libctf-nobfd0 -libctf0 libcurl3-gnutls libcurl4 libdatrie1 @@ -140,7 +120,6 @@ libfido2-1 libfontconfig1 libfreetype6 libfribidi0 -libgcc-13-dev libgcc-s1 libgcrypt20 libgd3 @@ -156,7 +135,6 @@ libgnutls-openssl27 libgnutls30 libgomp1 libgpg-error0 -libgprofng0 libgraphite2-3 libgssapi-krb5-2 libharfbuzz-gobject0 @@ -168,15 +146,11 @@ libheif-plugin-dav1d libheif-plugin-libde265 libheif1 libhogweed6 -libhwasan0 libhwy1 libicu74 libidn2-0 libimagequant0 libimath-3-1-29 -libisl23 -libitm1 -libjansson4 libjbig0 libjpeg-turbo8 libjpeg8 @@ -193,7 +167,6 @@ libldap2 liblerc4 liblmdb0 liblqr-1-0 -liblsan0 libltdl7 liblz4-1 liblzf1 @@ -211,14 +184,11 @@ libmemcached11 libmnl0 libmount1 libmp3lame0 -libmpc3 -libmpfr6 libmysqlclient21 libncursesw6 libnettle8 libnghttp2-14 libnpth0 -libnsl-dev libnsl2 libnspr4 libnss3 @@ -266,7 +236,6 @@ libselinux1 libsemanage-common libsemanage2 libsepol2 -libsframe1 libsharpyuv0 libsmartcols1 libsodium23 @@ -288,10 +257,7 @@ libtheora0 libtiff6 libtinfo6 libtirpc-common -libtirpc-dev libtirpc3 -libtsan2 -libubsan1 libudev1 libunibreak5 libunistring5 @@ -326,12 +292,10 @@ libxxhash0 libyaml-0-2 libzip4 libzstd1 -linux-libc-dev locales login logsave lsb-release -make mawk media-types mlock @@ -362,7 +326,6 @@ python3.12 python3.12-minimal readline-common rename -rpcsvc-proto rsync sed sensible-utils diff --git a/heroku-24/setup.sh b/heroku-24/setup.sh index f9100bac..ba47b845 100755 --- a/heroku-24/setup.sh +++ b/heroku-24/setup.sh @@ -68,7 +68,6 @@ packages=( ed file fontconfig - gcc geoip-database gettext-base gir1.2-harfbuzz-0.0 @@ -82,7 +81,6 @@ packages=( libargon2-1 libass9 libc-client2007e - libc6-dev libcairo2 libcurl4 libdatrie1 @@ -155,7 +153,6 @@ packages=( libzstd1 locales lsb-release - make netcat-openbsd openssh-client openssh-server