mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
Merge pull request #292760 from PigeonF/dockertools-build-layered-compressor
dockerTools: Fix changing compression method for `buildLayeredImage`
This commit is contained in:
commit
c740c98fc1
@ -178,6 +178,14 @@ in {
|
|||||||
"docker load --input='${examples.bashUncompressed}'",
|
"docker load --input='${examples.bashUncompressed}'",
|
||||||
"docker rmi ${examples.bashUncompressed.imageName}",
|
"docker rmi ${examples.bashUncompressed.imageName}",
|
||||||
)
|
)
|
||||||
|
docker.succeed(
|
||||||
|
"docker load --input='${examples.bashLayeredUncompressed}'",
|
||||||
|
"docker rmi ${examples.bashLayeredUncompressed.imageName}",
|
||||||
|
)
|
||||||
|
docker.succeed(
|
||||||
|
"docker load --input='${examples.bashLayeredZstdCompressed}'",
|
||||||
|
"docker rmi ${examples.bashLayeredZstdCompressed.imageName}",
|
||||||
|
)
|
||||||
|
|
||||||
with subtest(
|
with subtest(
|
||||||
"Check if the nix store is correctly initialized by listing "
|
"Check if the nix store is correctly initialized by listing "
|
||||||
|
@ -517,7 +517,7 @@ rec {
|
|||||||
|
|
||||||
buildLayeredImage = lib.makeOverridable ({ name, compressor ? "gz", ... }@args:
|
buildLayeredImage = lib.makeOverridable ({ name, compressor ? "gz", ... }@args:
|
||||||
let
|
let
|
||||||
stream = streamLayeredImage args;
|
stream = streamLayeredImage (builtins.removeAttrs args ["compressor"]);
|
||||||
compress = compressorForImage compressor name;
|
compress = compressorForImage compressor name;
|
||||||
in
|
in
|
||||||
runCommand "${baseNameOf name}.tar${compress.ext}"
|
runCommand "${baseNameOf name}.tar${compress.ext}"
|
||||||
@ -1287,7 +1287,7 @@ rec {
|
|||||||
# Wrapper around streamNixShellImage to build an image from the result
|
# Wrapper around streamNixShellImage to build an image from the result
|
||||||
buildNixShellImage = { drv, compressor ? "gz", ... }@args:
|
buildNixShellImage = { drv, compressor ? "gz", ... }@args:
|
||||||
let
|
let
|
||||||
stream = streamNixShellImage args;
|
stream = streamNixShellImage (builtins.removeAttrs args ["compressor"]);
|
||||||
compress = compressorForImage compressor drv.name;
|
compress = compressorForImage compressor drv.name;
|
||||||
in
|
in
|
||||||
runCommand "${drv.name}-env.tar${compress.ext}"
|
runCommand "${drv.name}-env.tar${compress.ext}"
|
||||||
|
@ -509,7 +509,23 @@ rec {
|
|||||||
contents = pkgs.bashInteractive;
|
contents = pkgs.bashInteractive;
|
||||||
};
|
};
|
||||||
|
|
||||||
# buildImage without explicit tag
|
# buildLayeredImage without compression
|
||||||
|
bashLayeredUncompressed = pkgs.dockerTools.buildLayeredImage {
|
||||||
|
name = "bash-layered-uncompressed";
|
||||||
|
tag = "latest";
|
||||||
|
compressor = "none";
|
||||||
|
contents = pkgs.bashInteractive;
|
||||||
|
};
|
||||||
|
|
||||||
|
# buildLayeredImage with zstd compression
|
||||||
|
bashLayeredZstdCompressed = pkgs.dockerTools.buildLayeredImage {
|
||||||
|
name = "bash-layered-zstd";
|
||||||
|
tag = "latest";
|
||||||
|
compressor = "zstd";
|
||||||
|
contents = pkgs.bashInteractive;
|
||||||
|
};
|
||||||
|
|
||||||
|
# streamLayeredImage without explicit tag
|
||||||
bashNoTagStreamLayered = pkgs.dockerTools.streamLayeredImage {
|
bashNoTagStreamLayered = pkgs.dockerTools.streamLayeredImage {
|
||||||
name = "bash-no-tag-stream-layered";
|
name = "bash-no-tag-stream-layered";
|
||||||
contents = pkgs.bashInteractive;
|
contents = pkgs.bashInteractive;
|
||||||
|
Loading…
Reference in New Issue
Block a user