G’day,
Short
When using Nix flakes to build a go application into a container, the glibc is largish ~45MB.
Is it possible to reduce the inclusion of:
/glibc/lib/gconv/ = ~8.5MB?
/share/i18n/charmaps = 3.1MB
locales = 13MB
zoneinfo = 1.9MB
(glibc version is 2.40-36)
I’d be cool with a bare minimum UTF-8 and GMT time.
Background
I’ve been slowly learning Nix and Nix flakes, working to compile a go library and put it into a container using Nix.
This is following on from a previous post, but making a new post because I’m asking about reducing glibc
Previous post:
Gomod2nix “cannot find module providing package”?
I just increased the complicity of the golang main.go by adding some go libary dependancies. Tagged here for reference.
This means that gomod2nix is really doing it’s magic, by nix-ifying the modules. Steps to create the container are:
# enter the dev shell
nix-shell
# regenerate the gomod2nix.toml
gomod2nix
# build the golangs into the container
nix build .#container
# load the docker container into the local registry
docker load < result
# run the container/golang app
docker run --rm example:0.1
# check image size
docker image ls | grep example
Looking at the container image using “dive” ( GitHub - wagoodman/dive: A tool for exploring each layer in a docker image ) it’s easy to see what’s included in the container
Any thoughts on reducing the size please?
Thanks in advance,
Dave
PS - This is a follow on from the great blog here: Adventures in building a Go container with Nix | James Williams