Merge pull request #58431 from alexbiehl/alex/nix-layers
dockerTools: align generated layer archives with docker's output
This commit is contained in:
commit
6af317616e
|
@ -344,7 +344,7 @@ rec {
|
||||||
# Tar up the layer and throw it into 'layer.tar'.
|
# Tar up the layer and throw it into 'layer.tar'.
|
||||||
echo "Packing layer..."
|
echo "Packing layer..."
|
||||||
mkdir $out
|
mkdir $out
|
||||||
tar -C layer --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=${toString uid} --group=${toString gid} -cf $out/layer.tar .
|
tar --transform='s|^\./||' -C layer --sort=name --mtime="@$SOURCE_DATE_EPOCH" --owner=${toString uid} --group=${toString gid} -cf $out/layer.tar .
|
||||||
|
|
||||||
# Compute a checksum of the tarball.
|
# Compute a checksum of the tarball.
|
||||||
echo "Computing layer checksum..."
|
echo "Computing layer checksum..."
|
||||||
|
|
|
@ -9,6 +9,7 @@ layerPath="./layers/$layerNumber"
|
||||||
echo "Creating layer #$layerNumber for $@"
|
echo "Creating layer #$layerNumber for $@"
|
||||||
|
|
||||||
mkdir -p "$layerPath"
|
mkdir -p "$layerPath"
|
||||||
|
tar --no-recursion -rf "$layerPath/layer.tar" /nix /nix/store
|
||||||
tar -rpf "$layerPath/layer.tar" --hard-dereference --sort=name \
|
tar -rpf "$layerPath/layer.tar" --hard-dereference --sort=name \
|
||||||
--mtime="@$SOURCE_DATE_EPOCH" \
|
--mtime="@$SOURCE_DATE_EPOCH" \
|
||||||
--owner=0 --group=0 "$@"
|
--owner=0 --group=0 "$@"
|
||||||
|
|
Loading…
Reference in New Issue