docker-nixpkgs/lib/buildCLIImage.nix
zimbatm 9baba96f89
abstract CLI image generation
and add busybox in all the images
2019-02-08 21:15:41 +01:00

27 lines
492 B
Nix

{ 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"
];
};
}