Open ineiti opened 1 week ago
OK, this is my current solution to the problem:
https://github.com/ineiti/fledger/blob/main/Dockerfile.fledger
It takes the binary created by rust in devbox, uses patchelf
to change the interpreter to the debian glibc, and creates a minimal docker image (including the certificates). This makes it 30MB instead of 980MB. I'd say it's a success :)
Of course I'd be happy to have a less patchy solution...
What problem are you trying to solve?
I want to create a minimal docker image to put my rust binary into. Usually one can do something like this for a minimal docker image:
https://dev.to/deciduously/use-multi-stage-docker-builds-for-statically-linked-rust-binaries-3jgd
Unfortunately, if I do the same with a devbox Dockerfile generated with
devbox generate dockerfile
, and copy the binary into a baseDebian
orUbuntu
image, I get something like:What solution would you like?
I would like to be able to do something similar with the link above, where the devbox-dockerfile builds the rust binary, and then I can copy the binary in a fresh Dockerimage with nothing else.
Alternatives you've considered
I tried various other base-images like
Debian
,Ubuntu
,jetpackio/devbox
(without the installation part), but of course they don't work, as the rust binary is linked against the/nix/store/...
glibc library.