mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-29 14:57:28 +03:00
dockerTools.buildLayeredImage: prepare to exclude some paths
Without changing behavior, since this code is fiddly, make it possible to add a filtering step before packaging individual paths.
This commit is contained in:
parent
aec80dddc0
commit
700f4c5388
@ -319,15 +319,20 @@ rec {
|
|||||||
| jshon -d config \
|
| jshon -d config \
|
||||||
| jshon -s "1970-01-01T00:00:01Z" -i created > generic.json
|
| jshon -s "1970-01-01T00:00:01Z" -i created > generic.json
|
||||||
|
|
||||||
|
|
||||||
# WARNING!
|
# WARNING!
|
||||||
# The following code is fiddly w.r.t. ensuring every layer is
|
# The following code is fiddly w.r.t. ensuring every layer is
|
||||||
# created, and that no paths are missed. If you change the
|
# created, and that no paths are missed. If you change the
|
||||||
# following head and tail call lines, double-check that your
|
# following head and tail call lines, double-check that your
|
||||||
# code behaves properly when the number of layers equals:
|
# code behaves properly when the number of layers equals:
|
||||||
# maxLayers-1, maxLayers, and maxLayers+1
|
# maxLayers-1, maxLayers, and maxLayers+1
|
||||||
head -n $((maxLayers - 1)) $paths | cat -n | xargs -P$NIX_BUILD_CORES -n2 ${storePathToLayer}
|
paths() {
|
||||||
if [ $(cat $paths | wc -l) -ge $maxLayers ]; then
|
cat $paths
|
||||||
tail -n+$maxLayers $paths | xargs ${storePathToLayer} $maxLayers
|
}
|
||||||
|
|
||||||
|
paths | head -n $((maxLayers - 1)) | cat -n | xargs -P$NIX_BUILD_CORES -n2 ${storePathToLayer}
|
||||||
|
if [ $(paths | wc -l) -ge $maxLayers ]; then
|
||||||
|
paths | tail -n+$maxLayers | xargs ${storePathToLayer} $maxLayers
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Finished building layer '$name'"
|
echo "Finished building layer '$name'"
|
||||||
|
Loading…
Reference in New Issue
Block a user