diff --git a/docs/content/examples/image/image.nix b/docs/content/examples/image/image.nix index 74938da..dfd2ff1 100644 --- a/docs/content/examples/image/image.nix +++ b/docs/content/examples/image/image.nix @@ -1,5 +1,5 @@ { dockerTools, nginx }: -dockerTools.buildLayeredImage { +dockerTools.streamLayeredImage { name = "nginx"; contents = [ nginx ]; extraCommands = '' diff --git a/lib/docker/default.nix b/lib/docker/default.nix index 5bb67b0..2193c96 100644 --- a/lib/docker/default.nix +++ b/lib/docker/default.nix @@ -2,13 +2,18 @@ with lib; { copyDockerImages = { images, dest, args ? "" }: pkgs.writeScript "copy-docker-images.sh" (concatMapStrings - (image: '' - #!${pkgs.runtimeShell} + (image: + let + prefix = optionalString (image.isExe or false) "${image} | ${pkgs.gzip}/bin/gzip --fast |"; + src = if image.isExe or false then "/dev/stdin" else ${image}; + in + '' + #!${pkgs.runtimeShell} - set -e + set -e - echo "copying '${image.imageName}:${image.imageTag}' to '${dest}/${image.imageName}:${image.imageTag}'" - ${pkgs.skopeo}/bin/skopeo copy ${args} $@ docker-archive:${image} ${dest}/${image.imageName}:${image.imageTag} - '') + echo "copying '${image.imageName}:${image.imageTag}' to '${dest}/${image.imageName}:${image.imageTag}'" + ${prefix} ${pkgs.skopeo}/bin/skopeo copy ${args} $@ docker-archive:${src} ${dest}/${image.imageName}:${image.imageTag} + '') images); }