From 25aed7eae4087b0a2e0e89fcdaa4052f95ba5adb Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 19 Oct 2016 18:40:29 -0200 Subject: [PATCH] Calculate layers to keep only when necessary --- image/build.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/build.rb b/image/build.rb index 30a0420..2860293 100644 --- a/image/build.rb +++ b/image/build.rb @@ -31,7 +31,7 @@ def build(image, version) if image[:squash] - layers_to_squash = run("docker history #{img} | wc -l").first.to_i - (1 + image[:layers_to_keep]) + layers_to_squash = run("docker history #{img} | wc -l").first.to_i - (1 + image[:layers_to_keep]) if image[:layers_to_keep] != nil if layers_to_keep != nil run("docker-squash -t #{image[:tag]} --verbose -f #{layers_to_squash} #{img}") -- 2.25.1