3
0
Fork 0
forked from mirrors/nixpkgs

dockerTools: buildLayeredImage passthru imageTag

This commit is contained in:
Jaka Hudoklin 2019-01-16 13:47:16 +01:00
parent eebd1a9263
commit 1787afb861
No known key found for this signature in database
GPG key ID: 6A08896BFD32BD95

View file

@ -537,14 +537,19 @@ rec {
buildInputs = [ jshon pigz coreutils findutils jq ];
# Image name and tag must be lowercase
imageName = lib.toLower name;
imageTag = if tag == null then "" else lib.toLower tag;
baseJson = configJson;
passthru.imageTag =
if tag == null
then lib.head (lib.splitString "-" (lib.last (lib.splitString "/" result)))
else lib.toLower tag;
} ''
${lib.optionalString (tag == null) ''
${if (tag == null) then ''
outName="$(basename "$out")"
outHash=$(echo "$outName" | cut -d - -f 1)
imageTag=$outHash
'' else ''
imageTag="${tag}"
''}
find ${bulkLayers} -mindepth 1 -maxdepth 1 | sort -t/ -k5 -n > layer-list