add meta attributes to all images
augment the images with meta attributes from the input packages. and then use the meta.description as dockerhub metadata.
This commit is contained in:
parent
8cbbfe7009
commit
2aefa0599e
4 changed files with 72 additions and 59 deletions
|
@ -11,7 +11,11 @@ password=$2
|
||||||
org=${3:-nixpkgs}
|
org=${3:-nixpkgs}
|
||||||
user=$username:$password
|
user=$username:$password
|
||||||
|
|
||||||
releases_json=$(nix-instantiate ./release.nix --strict --eval --json)
|
nix_eval() {
|
||||||
|
nix-instantiate --strict --eval --json "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
releases_json=$(nix_eval release.nix)
|
||||||
|
|
||||||
to_json() {
|
to_json() {
|
||||||
local desc=$1 full_desc=$2
|
local desc=$1 full_desc=$2
|
||||||
|
@ -25,7 +29,7 @@ echo "=== Updating Docker Hub project descriptions"
|
||||||
|
|
||||||
for attr in $(echo "$releases_json" | jq -r "keys[]") ; do
|
for attr in $(echo "$releases_json" | jq -r "keys[]") ; do
|
||||||
echo "--- $attr"
|
echo "--- $attr"
|
||||||
desc="$attr is automatically built from nix-community/docker-nixpkgs"
|
desc=$(nix_eval ./release.nix -A "$attr.meta.description" | jq -r .)
|
||||||
|
|
||||||
if [[ -f "$attr/README.md" ]]; then
|
if [[ -f "$attr/README.md" ]]; then
|
||||||
full_desc=$(< "$attr/README.md")
|
full_desc=$(< "$attr/README.md")
|
||||||
|
|
|
@ -5,28 +5,32 @@
|
||||||
{ drv # derivation to build the image for
|
{ drv # derivation to build the image for
|
||||||
# Name of the binary to run by default
|
# Name of the binary to run by default
|
||||||
, binName ? (builtins.parseDrvName drv.name).name
|
, binName ? (builtins.parseDrvName drv.name).name
|
||||||
|
, meta ? drv.meta
|
||||||
}:
|
}:
|
||||||
dockerTools.buildLayeredImage {
|
let
|
||||||
name = drv.name;
|
image = dockerTools.buildLayeredImage {
|
||||||
|
name = drv.name;
|
||||||
|
|
||||||
contents = [
|
contents = [
|
||||||
# add a /bin/sh on all images
|
# add a /bin/sh on all images
|
||||||
busybox
|
busybox
|
||||||
# most program need TLS certs
|
# most program need TLS certs
|
||||||
cacert
|
cacert
|
||||||
drv
|
drv
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
|
||||||
Cmd = [ "/bin/${binName}" ];
|
|
||||||
Env = [
|
|
||||||
"PATH=/bin"
|
|
||||||
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
|
|
||||||
];
|
];
|
||||||
Labels = {
|
|
||||||
# https://github.com/microscaling/microscaling/blob/55a2d7b91ce7513e07f8b1fd91bbed8df59aed5a/Dockerfile#L22-L33
|
config = {
|
||||||
"org.label-schema.vcs-ref" = "master";
|
Cmd = [ "/bin/${binName}" ];
|
||||||
"org.label-schema.vcs-url" = "https://github.com/nix-community/docker-nixpkgs";
|
Env = [
|
||||||
|
"PATH=/bin"
|
||||||
|
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
|
||||||
|
];
|
||||||
|
Labels = {
|
||||||
|
# https://github.com/microscaling/microscaling/blob/55a2d7b91ce7513e07f8b1fd91bbed8df59aed5a/Dockerfile#L22-L33
|
||||||
|
"org.label-schema.vcs-ref" = "master";
|
||||||
|
"org.label-schema.vcs-url" = "https://github.com/nix-community/docker-nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
in
|
||||||
|
image // { meta = meta // image.meta; }
|
||||||
|
|
|
@ -10,44 +10,47 @@
|
||||||
, nix
|
, nix
|
||||||
, xz
|
, xz
|
||||||
}:
|
}:
|
||||||
dockerTools.buildImageWithNixDb {
|
let
|
||||||
inherit (nix) name;
|
image = dockerTools.buildImageWithNixDb {
|
||||||
|
inherit (nix) name;
|
||||||
|
|
||||||
contents = [
|
contents = [
|
||||||
./root
|
./root
|
||||||
coreutils
|
coreutils
|
||||||
# add /bin/sh
|
# add /bin/sh
|
||||||
bash
|
bash
|
||||||
nix
|
nix
|
||||||
|
|
||||||
# runtime dependencies of nix
|
# runtime dependencies of nix
|
||||||
cacert
|
cacert
|
||||||
gitMinimal
|
gitMinimal
|
||||||
gnutar
|
gnutar
|
||||||
gzip
|
gzip
|
||||||
xz
|
xz
|
||||||
|
|
||||||
# for haskell binaries
|
# for haskell binaries
|
||||||
iana-etc
|
iana-etc
|
||||||
];
|
|
||||||
|
|
||||||
extraCommands = ''
|
|
||||||
# for /usr/bin/env
|
|
||||||
mkdir usr
|
|
||||||
ln -s ../bin usr/bin
|
|
||||||
|
|
||||||
# make sure /tmp exists
|
|
||||||
mkdir -m 0777 tmp
|
|
||||||
'';
|
|
||||||
|
|
||||||
config = {
|
|
||||||
Cmd = [ "/bin/bash" ];
|
|
||||||
Env = [
|
|
||||||
"ENV=/etc/profile.d/nix.sh"
|
|
||||||
"NIX_PATH=nixpkgs=channel:nixpkgs-unstable"
|
|
||||||
"PAGER=cat"
|
|
||||||
"PATH=/usr/bin:/bin"
|
|
||||||
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
extraCommands = ''
|
||||||
|
# for /usr/bin/env
|
||||||
|
mkdir usr
|
||||||
|
ln -s ../bin usr/bin
|
||||||
|
|
||||||
|
# make sure /tmp exists
|
||||||
|
mkdir -m 0777 tmp
|
||||||
|
'';
|
||||||
|
|
||||||
|
config = {
|
||||||
|
Cmd = [ "/bin/bash" ];
|
||||||
|
Env = [
|
||||||
|
"ENV=/etc/profile.d/nix.sh"
|
||||||
|
"NIX_PATH=nixpkgs=channel:nixpkgs-unstable"
|
||||||
|
"PAGER=cat"
|
||||||
|
"PATH=/usr/bin:/bin"
|
||||||
|
"SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
in
|
||||||
|
image // { meta = nix.meta // image.meta; }
|
||||||
|
|
|
@ -18,7 +18,9 @@ _: pkgs: {
|
||||||
kubectl = pkgs.callPackage ./kubectl {};
|
kubectl = pkgs.callPackage ./kubectl {};
|
||||||
kubernetes-helm = pkgs.callPackage ./kubernetes-helm {};
|
kubernetes-helm = pkgs.callPackage ./kubernetes-helm {};
|
||||||
nix = pkgs.callPackage ./nix {};
|
nix = pkgs.callPackage ./nix {};
|
||||||
nix-unstable = nix.overrideAttrs (self: { nix = pkgs.nixUnstable; });
|
nix-unstable = nix.override {
|
||||||
|
nix = pkgs.nixUnstable;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue