3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #55859 from nlewo/dockerTools-fix-55290

dockerTools.buildImage: preserve layers ordering at image repacking
This commit is contained in:
Linus Heckemann 2019-02-18 17:15:20 +01:00 committed by GitHub
commit 01dacc84d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -776,7 +776,7 @@ rec {
imageJson=$(cat ${baseJson} | jq ". + {\"rootfs\": {\"diff_ids\": [], \"type\": \"layers\"}}")
manifestJson=$(jq -n "[{\"RepoTags\":[\"$imageName:$imageTag\"]}]")
for layerTar in $(cat ./layer-list); do
for layerTar in $(tac ./layer-list); do
layerChecksum=$(sha256sum image/$layerTar | cut -d ' ' -f1)
imageJson=$(echo "$imageJson" | jq ".history |= [{\"created\": \"$(jq -r .created ${baseJson})\"}] + .")
imageJson=$(echo "$imageJson" | jq ".rootfs.diff_ids |= [\"sha256:$layerChecksum\"] + .")