diff options
Diffstat (limited to 'pkgs/build-support/docker/store-path-to-layer.sh')
-rwxr-xr-x | pkgs/build-support/docker/store-path-to-layer.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkgs/build-support/docker/store-path-to-layer.sh b/pkgs/build-support/docker/store-path-to-layer.sh new file mode 100755 index 000000000000..ff814c1f6130 --- /dev/null +++ b/pkgs/build-support/docker/store-path-to-layer.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -eu + +layerNumber=$1 +shift + +layerPath="./layers/$layerNumber" +echo "Creating layer #$layerNumber for $@" + +mkdir -p "$layerPath" +tar -rpf "$layerPath/layer.tar" --hard-dereference --sort=name \ + --mtime="@$SOURCE_DATE_EPOCH" \ + --owner=0 --group=0 "$@" + +# Compute a checksum of the tarball. +tarhash=$(tarsum < $layerPath/layer.tar) + +# Add a 'checksum' field to the JSON, with the value set to the +# checksum of the tarball. +cat ./generic.json | jshon -s "$tarhash" -i checksum > $layerPath/json + +# Indicate to docker that we're using schema version 1.0. +echo -n "1.0" > $layerPath/VERSION |