emk / rust-musl-builder

Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k stars 193 forks source link

switch from ubuntu to debian base for smaller build bot images #14

Closed mcandre closed 6 years ago

mcandre commented 7 years ago

Shrink the rust musl build bot Docker image, by using a leaner base image. Debian shaves off a few MB compared to Ubuntu.

Tested the debian-based build bot by compiling https://github.com/mcandre/ios7crypt-rs .

Note that the current Dockerfile in master actually builds to 600-700MB with Ubuntu/Debian bases, while the old DockerHub images report as 200-300MB. Perhaps recent packages for the rust build bot have grown in size?

emk commented 7 years ago

Thank you for the suggestion! Unless it makes an especially dramatic difference in size (more than 30%, say), I'm going to stick with Ubuntu for now, because I use an Ubuntu setup at work, and it's one less tiny difference for me to remember. But I agree this would be a good idea if I were slightly less lazy. :-)

mcandre commented 7 years ago

Wow, both the ubuntu and debian Docker base image maintainers have dramatically reduced their images, so the savings are now only 5 MB (out of 53MB). The difference was a lot larger just a few months ago, when both images were in the hundreds of MB. I still think the base should be as small as possible, if only for the sake of downstream users who may spin up hundreds of build bots. In any case, Debian > Ubuntu for most server-side things.

emk commented 6 years ago

A full compiler toolchain, including both C and Rust (which we need for this image) is going to be a few hundred megabytes minimum. Additionally, the build image should not normally be used for deployment, which is the goal of static linking, so this only affects build bots.

As previously mentioned, by targeting Ubuntu for the build image, I make my life as a maintainer simpler. :-)