Skip to content
This repository has been archived by the owner on Apr 12, 2021. It is now read-only.

Commit

Permalink
dockerTools.buildLayeredImage: restore layer sharing
Browse files Browse the repository at this point in the history
PR #58431 added /nix/store to each layer.tar. However, the timestamp was
not explicitly set while adding /nix and /nix/store to the archive. This
resulted in different SHA256 hashes of layer.tar between image builds.

This change sets time and owner when tar'ing /nix/store.
  • Loading branch information
danieldk committed Jun 6, 2019
1 parent 8b3d0b0 commit d7f3186
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkgs/build-support/docker/store-path-to-layer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ layerPath="./layers/$layerNumber"
echo "Creating layer #$layerNumber for $@"

mkdir -p "$layerPath"
tar --no-recursion -rf "$layerPath/layer.tar" /nix /nix/store
tar --no-recursion -rf "$layerPath/layer.tar" \
--mtime="@$SOURCE_DATE_EPOCH" \
--owner=0 --group=0 /nix /nix/store
tar -rpf "$layerPath/layer.tar" --hard-dereference --sort=name \
--mtime="@$SOURCE_DATE_EPOCH" \
--owner=0 --group=0 "$@"
Expand Down

0 comments on commit d7f3186

Please sign in to comment.