dockerTools.runWithOverlay: Avoid cluttering $out and copying

This commit is contained in:
Robert Hensing 2021-09-29 09:34:06 +02:00
parent 8863a5199d
commit 63bf4539b9

View File

@ -191,13 +191,13 @@ rec {
, postMount ? "" , postMount ? ""
, postUmount ? "" , postUmount ? ""
}: }:
let vmTools.runInLinuxVM (
result = vmTools.runInLinuxVM (
runCommand name runCommand name
{ {
preVM = vmTools.createEmptyImage { preVM = vmTools.createEmptyImage {
size = diskSize; size = diskSize;
fullName = "docker-run-disk"; fullName = "docker-run-disk";
destination = "./image";
}; };
inherit fromImage fromImageName fromImageTag; inherit fromImage fromImageName fromImageTag;
@ -278,16 +278,6 @@ rec {
${postUmount} ${postUmount}
''); '');
in
runCommand name { } ''
cd ${result}
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 }: exportImage = { name ? fromImage.name, fromImage, fromImageName ? null, fromImageTag ? null, diskSize ? 1024 }:
runWithOverlay { runWithOverlay {