ubi-micro icon indicating copy to clipboard operation
ubi-micro copied to clipboard

Add steps to minimize locale

Open ghost opened this issue 5 years ago • 3 comments

When creating images like this, they are still quite large due to locale.

Consider adding steps from https://github.com/containers/buildah/issues/532 to your Dockerfiles.

E.g., for me, this here saved 200MB (build from fedora container, RHEL 8 would be the same). I'm not sure about --setopt=override_install_langs=en_US.utf8 in the context of Fedora / RHEL 8, the CLI argument might be different:

buildah unshare  # only needed when not root, this will drop you in a new namespace
buildah from scratch
scratchmnt=$(buildah mount working-container)
yum install -y --releasever=32 --installroot=$scratchmnt --setopt install_weak_deps=false --setopt=tsflags=nodocs --setopt=override_install_langs=en_US.utf8  nodejs
rm $scratchmnt/usr/lib/locale/locale-archive*    # this was needed as in my fedora32 environment, the lang override did not work
find $scratchmnt/usr/share/locale/ \! -name '*en*' -exec rm -rf \{\} \;   # this was needed as in my fedora32 environment, the lang override did not work
rm -Rf $scratchmnt/var/cache/*
rm -Rf $scratchmnt/var/lib/rpm

ghost avatar Jun 04 '20 12:06 ghost

Instead, install glibc-mininal-langpack from the start and avoid the problem entirely.

jamescassell avatar Jun 04 '20 12:06 jamescassell

Oh sorry, I missed that this is already the case: glibc-minimal-langpack

Apologies for opening this issue, then.

ghost avatar Jun 04 '20 13:06 ghost

I guess it's worth noting that the ubi7 dockerfile uses glibc and not glibc-minimal-langpack. The ubi8 dockerfile does use glibc-minimal-langpack.

ferrx avatar Jul 31 '20 16:07 ferrx