about summary refs log tree commit diff
path: root/pkgs/build-support/docker/examples.nix
diff options
context:
space:
mode:
authorJoel Höner <athre0z@zyantific.com>2024-02-17 17:48:57 +0100
committerJoel Höner <athre0z@zyantific.com>2024-02-17 18:52:42 +0100
commit4b603ad9cd26f71bd17d52c2f6923ce6ba163c63 (patch)
tree0126a47239e6db80ad26ad7a14dcc40a3e80708c /pkgs/build-support/docker/examples.nix
parentaf435645aed2bd50acad1f0866f3a6285de25e99 (diff)
downloadnixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.gz
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.bz2
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.lz
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.xz
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.tar.zst
nixlib-4b603ad9cd26f71bd17d52c2f6923ce6ba163c63.zip
dockerTools: configurable compression schema
This commit adds support for swapping out the compression algorithm
used in all major docker-tools commands that generate images. The
default algorithm remains unchanged (gzip).
Diffstat (limited to 'pkgs/build-support/docker/examples.nix')
-rw-r--r--pkgs/build-support/docker/examples.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix
index 5784e650dc2e..64dd112a950f 100644
--- a/pkgs/build-support/docker/examples.nix
+++ b/pkgs/build-support/docker/examples.nix
@@ -480,6 +480,22 @@ rec {
     layerC = layerOnTopOf layerB "c";
   in layerC;
 
+  bashUncompressed = pkgs.dockerTools.buildImage {
+    name = "bash-uncompressed";
+    tag = "latest";
+    compressor = "none";
+    # Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
+    copyToRoot = pkgs.bashInteractive;
+  };
+
+  bashZstdCompressed = pkgs.dockerTools.buildImage {
+    name = "bash-zstd";
+    tag = "latest";
+    compressor = "zstd";
+    # Not recommended. Use `buildEnv` between copy and packages to avoid file duplication.
+    copyToRoot = pkgs.bashInteractive;
+  };
+
   # buildImage without explicit tag
   bashNoTag = pkgs.dockerTools.buildImage {
     name = "bash-no-tag";
@@ -614,6 +630,12 @@ rec {
     layeredImageWithFakeRootCommands
   ];
 
+  mergeVaryingCompressor = pkgs.dockerTools.mergeImages [
+    redis
+    bashUncompressed
+    bashZstdCompressed
+  ];
+
   helloOnRoot = pkgs.dockerTools.streamLayeredImage {
     name = "hello";
     tag = "latest";