From fa0cc611ff8ae49efd76e2ed7700a2cdef5707c4 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Fri, 14 Feb 2020 09:27:07 +1100 Subject: [PATCH] dockerTools: fix export --- pkgs/build-support/docker/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 4bda4d2a5c23..2d327a9426dd 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -280,9 +280,13 @@ rec { ''); in runCommand name { } '' - mkdir -p $out cd ${result} - cp layer.tar json VERSION $out + if [ -e json ] && [ -e VERSION ] ; then + mkdir -p $out + cp layer.tar json VERSION $out + else + cp layer.tar $out + fi ''; exportImage = { name ? fromImage.name, fromImage, fromImageName ? null, fromImageTag ? null, diskSize ? 1024 }: @@ -291,7 +295,7 @@ rec { postMount = '' echo "Packing raw image..." - tar -C mnt --hard-dereference --sort=name --mtime="@$SOURCE_DATE_EPOCH" -cf $out . + tar -C mnt --hard-dereference --sort=name --mtime="@$SOURCE_DATE_EPOCH" -cf $out/layer.tar . ''; };