summary refs log tree commit diff
path: root/pkgs/build-support/docker
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2019-12-16 12:58:27 -0500
committerGraham Christensen <graham@grahamc.com>2019-12-16 13:03:15 -0500
commit12e24163803c2bd0051d93fe2957351eb8046735 (patch)
treebe6782b4b4ffd147b6e2b3e428dd9708fc1a4370 /pkgs/build-support/docker
parent700f4c538885bb9c1290d1723ec5380c2fe6e910 (diff)
downloadnixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.tar
nixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.tar.gz
nixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.tar.bz2
nixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.tar.lz
nixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.tar.xz
nixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.tar.zst
nixpkgs-12e24163803c2bd0051d93fe2957351eb8046735.zip
dockerTools.buildLayeredImage: Exclude top level implementation detail layers
Diffstat (limited to 'pkgs/build-support/docker')
-rw-r--r--pkgs/build-support/docker/default.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix
index eb3863bcfba..bdc4f6434ed 100644
--- a/pkgs/build-support/docker/default.nix
+++ b/pkgs/build-support/docker/default.nix
@@ -287,6 +287,12 @@ rec {
   # unless there are more paths than $maxLayers. In that case, create
   # $maxLayers-1 for the most popular layers, and smush the remainaing
   # store paths in to one final layer.
+  #
+  # NOTE: the `closures` parameter is a list of closures to include.
+  # The TOP LEVEL store paths themselves will never be present in the
+  # resulting image. At this time (2019-12-16) none of these layers
+  # are appropriate to include, as they are all created as
+  # implementation details of dockerTools.
   mkManyPureLayers = {
     name,
     # Files to add to the layer.
@@ -327,7 +333,7 @@ rec {
       # code behaves properly when the number of layers equals:
       #      maxLayers-1, maxLayers, and maxLayers+1
       paths() {
-        cat $paths
+        cat $paths ${lib.concatMapStringsSep " " (path: "| grep -v ${path}") (closures ++ [ overallClosure ])}
       }
 
       paths | head -n $((maxLayers - 1)) | cat -n | xargs -P$NIX_BUILD_CORES -n2 ${storePathToLayer}