mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
dockerTools: preserve order of images in manifest
This commit is contained in:
parent
dcc9aef015
commit
b2aa1f9d7a
@ -692,15 +692,24 @@ rec {
|
|||||||
} ''
|
} ''
|
||||||
mkdir image inputs
|
mkdir image inputs
|
||||||
# Extract images
|
# Extract images
|
||||||
|
repos=()
|
||||||
|
manifests=()
|
||||||
for item in $images; do
|
for item in $images; do
|
||||||
mkdir inputs/$(basename $item)
|
name=$(basename $item)
|
||||||
tar -I pigz -xf $item -C inputs/$(basename $item)
|
mkdir inputs/$name
|
||||||
|
tar -I pigz -xf $item -C inputs/$name
|
||||||
|
if [ -f inputs/$name/repositories ]; then
|
||||||
|
repos+=(inputs/$name/repositories)
|
||||||
|
fi
|
||||||
|
if [ -f inputs/$name/manifest.json ]; then
|
||||||
|
manifests+=(inputs/$name/manifest.json)
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
# Copy all layers from input images to output image directory
|
# Copy all layers from input images to output image directory
|
||||||
cp -R --no-clobber inputs/*/* image/
|
cp -R --no-clobber inputs/*/* image/
|
||||||
# Merge repositories objects and manifests
|
# Merge repositories objects and manifests
|
||||||
jq -s add inputs/*/repositories > repositories
|
jq -s add "''${repos[@]}" > repositories
|
||||||
jq -s add inputs/*/manifest.json > manifest.json
|
jq -s add "''${manifests[@]}" > manifest.json
|
||||||
# Replace output image repositories and manifest with merged versions
|
# Replace output image repositories and manifest with merged versions
|
||||||
mv repositories image/repositories
|
mv repositories image/repositories
|
||||||
mv manifest.json image/manifest.json
|
mv manifest.json image/manifest.json
|
||||||
|
Loading…
Reference in New Issue
Block a user