abstract CLI image generation

and add busybox in all the images
This commit is contained in:
zimbatm 2019-02-08 21:15:38 +01:00
parent 10e9882705
commit 9baba96f89
No known key found for this signature in database
GPG key ID: 71BAF6D40C1D63D7
6 changed files with 43 additions and 68 deletions

27
lib/buildCLIImage.nix Normal file
View file

@ -0,0 +1,27 @@
{ dockerTools
, busybox
, cacert
}:
{ drv # derivation to build the image for
# Name of the binary to run by default
, binName ? (builtins.parseDrvName drv.name).name
}:
dockerTools.buildLayeredImage {
name = drv.name;
contents = [
# add a /bin/sh on all images
busybox
# most program need TLS certs
cacert
drv
];
config = {
Cmd = [ "/bin/${binName}" ];
Env = [
"PATH=/bin"
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
];
};
}