diff options
author | Robert Hensing <robert@roberthensing.nl> | 2021-10-18 12:39:51 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2021-10-18 12:41:51 +0200 |
commit | 3b9d05e114550db6ea23befa078bd978371d863c (patch) | |
tree | a20746d84a3b76268f7b38018b60e42b9535baa2 /pkgs/build-support | |
parent | c7fd252d324f6eb4eeb9a769d1533cb4ede361ad (diff) |
dockerTools: Fix and test #118722 path in contents
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/docker/default.nix | 7 | ||||
-rw-r--r-- | pkgs/build-support/docker/examples.nix | 12 |
2 files changed, 18 insertions, 1 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 47fd99c12f8e9..a42b025bc7f2a 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -37,6 +37,11 @@ let + inherit (lib) + escapeShellArgs + toList + ; + mkDbExtraCommand = contents: let contentsList = if builtins.isList contents then contents else [ contents ]; @@ -402,7 +407,7 @@ rec { preMount = lib.optionalString (contents != null && contents != [ ]) '' echo "Adding contents..." - for item in ${toString contents}; do + for item in ${escapeShellArgs (map (c: "${c}") (toList contents))}; do echo "Adding $item..." rsync -a${if keepContentsDirlinks then "K" else "k"} --chown=0:0 $item/ layer/ done diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix index 9f6823a587899..141c2ba0ea454 100644 --- a/pkgs/build-support/docker/examples.nix +++ b/pkgs/build-support/docker/examples.nix @@ -553,4 +553,16 @@ rec { # Example export of the bash image exportBash = pkgs.dockerTools.exportImage { fromImage = bash; }; + + build-image-with-path = buildImage { + name = "build-image-with-path"; + tag = "latest"; + contents = [ pkgs.bashInteractive ./test-dummy ]; + }; + + layered-image-with-path = pkgs.dockerTools.streamLayeredImage { + name = "layered-image-with-path"; + tag = "latest"; + contents = [ pkgs.bashInteractive ./test-dummy ]; + }; } |