From 3c8e80cacedf0a4197c90a07799819aeeb5ed1f7 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Sat, 11 Feb 2023 08:08:26 +0000 Subject: [PATCH] docker/podman: squash newly built layers into a single new layer --- kernel.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel.go b/kernel.go index 1c4e83e..8a7d086 100644 --- a/kernel.go +++ b/kernel.go @@ -96,7 +96,7 @@ func (cmd *KernelDockerRegenCmd) Run(kernelCmd *KernelCmd, g *Globals) (err erro return } - cmd := exec.Command("docker", "build", "-t", + cmd := exec.Command("docker", "build", "--squash", "-t", d.ContainerName, imagePath) var rawOutput []byte rawOutput, err = cmd.CombinedOutput() @@ -346,7 +346,7 @@ func generateBaseDockerImage(registry string, commands []config.DockerCommand, return } - cmd = exec.Command("docker", "build", "-t", sk.DockerName(), imagePath) + cmd = exec.Command("docker", "build", "--squash", "-t", sk.DockerName(), imagePath) rawOutput, err = cmd.CombinedOutput() if err != nil { log.Printf("Base image for %s:%s generating error, see log", @@ -413,7 +413,7 @@ func dockerImageAppend(sk config.KernelMask, pkgname string) (err error) { return } - cmd := exec.Command("docker", "build", "-t", sk.DockerName(), imagePath) + cmd := exec.Command("docker", "build", "--squash", "-t", sk.DockerName(), imagePath) rawOutput, err := cmd.CombinedOutput() if err != nil { // Fallback to previous state