abstract CLI image generation
and add busybox in all the images
This commit is contained in:
parent
10e9882705
commit
9baba96f89
6 changed files with 43 additions and 68 deletions
27
lib/buildCLIImage.nix
Normal file
27
lib/buildCLIImage.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue