summary refs log tree commit diff
path: root/pkgs/build-support/docker
diff options
context:
space:
mode:
authorDaniël de Kok <me@danieldk.eu>2019-06-05 11:10:00 +0200
committerDaniël de Kok <me@danieldk.eu>2019-06-06 07:40:20 +0200
commitd7f3186b4818fe8c6aaa5922861ed611c7249475 (patch)
tree8bde0a77558e4f66d3a3ab5f221833e650b4f582 /pkgs/build-support/docker
parent8b3d0b00d571878d0e5635f471ef3944b049478b (diff)
downloadnixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.tar
nixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.tar.gz
nixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.tar.bz2
nixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.tar.lz
nixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.tar.xz
nixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.tar.zst
nixpkgs-d7f3186b4818fe8c6aaa5922861ed611c7249475.zip
dockerTools.buildLayeredImage: restore layer sharing
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.
Diffstat (limited to 'pkgs/build-support/docker')
-rwxr-xr-xpkgs/build-support/docker/store-path-to-layer.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkgs/build-support/docker/store-path-to-layer.sh b/pkgs/build-support/docker/store-path-to-layer.sh
index 98c5b8cc212..bcad9e83e06 100755
--- a/pkgs/build-support/docker/store-path-to-layer.sh
+++ b/pkgs/build-support/docker/store-path-to-layer.sh
@@ -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 "$@"