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 / /