From 553f7f8d4b4a3f7a2b33cfd44767e105cfe7f579 Mon Sep 17 00:00:00 2001 From: Adphi Date: Wed, 21 Jan 2026 16:34:23 +0100 Subject: [PATCH] fix: squash image layers during build close #75 Signed-off-by: Adphi --- templates/alpine.Dockerfile | 6 +++++- templates/centos.Dockerfile | 6 +++++- templates/debian.Dockerfile | 6 +++++- templates/ubuntu.Dockerfile | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/templates/alpine.Dockerfile b/templates/alpine.Dockerfile index 540bfb8..67d1822 100644 --- a/templates/alpine.Dockerfile +++ b/templates/alpine.Dockerfile @@ -1,4 +1,4 @@ -FROM {{ .Image }} +FROM {{ .Image }} AS rootfs USER root @@ -48,3 +48,7 @@ RUN apk add --no-cache \ {{- end }} grub || true {{- end }} + +FROM scratch + +COPY --from=rootfs / / diff --git a/templates/centos.Dockerfile b/templates/centos.Dockerfile index 78e1ea1..4dada8a 100644 --- a/templates/centos.Dockerfile +++ b/templates/centos.Dockerfile @@ -1,4 +1,4 @@ -FROM {{ .Image }} +FROM {{ .Image }} AS rootfs USER root @@ -46,3 +46,7 @@ RUN cd /boot && \ RUN yum clean all && \ rm -rf /var/cache/yum + +FROM scratch + +COPY --from=rootfs / / diff --git a/templates/debian.Dockerfile b/templates/debian.Dockerfile index 0443523..3d1c23e 100644 --- a/templates/debian.Dockerfile +++ b/templates/debian.Dockerfile @@ -1,4 +1,4 @@ -FROM {{ .Image }} +FROM {{ .Image }} AS rootfs USER root @@ -77,3 +77,7 @@ RUN mv $(ls -t /boot/vmlinuz-* | head -n 1) /boot/vmlinuz && \ RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* + +FROM scratch + +COPY --from=rootfs / / diff --git a/templates/ubuntu.Dockerfile b/templates/ubuntu.Dockerfile index f5db285..d7d1e31 100644 --- a/templates/ubuntu.Dockerfile +++ b/templates/ubuntu.Dockerfile @@ -1,4 +1,4 @@ -FROM {{ .Image }} +FROM {{ .Image }} AS rootfs USER root @@ -68,3 +68,7 @@ RUN mv $(ls -t /boot/vmlinuz-* | head -n 1) /boot/vmlinuz && \ RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* + +FROM scratch + +COPY --from=rootfs / /