From 12e24163803c2bd0051d93fe2957351eb8046735 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Mon, 16 Dec 2019 12:58:27 -0500 Subject: dockerTools.buildLayeredImage: Exclude top level implementation detail layers --- pkgs/build-support/docker/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pkgs/build-support/docker') 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} -- cgit 1.4.1