dockerTools.buildLayeredImage: Exclude top level implementation detail layers

This commit is contained in:
Graham Christensen 2019-12-16 12:58:27 -05:00
parent 700f4c5388
commit 12e2416380
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F

View file

@ -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}