docker-nixpkgs/lib/buildCLIImage.nix
zimbatm e9633d0d58
add label to all CLI images
Try this out. These labels are used by Docker Hub to link back to the
repository.
2019-02-15 14:05:12 +01:00

31 lines
645 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"
];
Labels = {
"org.label-schema.vcs-ref" = "master";
"org.label-schema.vcs-url" = "https://github.com/nix-community/docker-nixpkgs";
};
};
}