[PATCH 2/7] ci: container: download and delete kvx.tgz in the same layer

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Mar 26 05:36:14 PDT 2025


The results of each RUN instruction are saved to layer in the resulting
container. Having a separate RUN instruction to delete temporary files
thus only hides them at runtime, but the files are still there eating
up space.

The common wisdom is thus to combine creation, usage and deletion of
temporary files into a single RUN instruction.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 test/Containerfile | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/test/Containerfile b/test/Containerfile
index 94b3f618261c..246f50d5b648 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -65,12 +65,10 @@ RUN korg_crosstool_dl() { wget -nv -O - https://mirrors.edge.kernel.org/pub/tool
     korg_crosstool_dl x86_64 ${GCC_VERSION} powerpc-linux     && \
     korg_crosstool_dl x86_64 ${GCC_VERSION} riscv64-linux
 
-RUN wget -nv -O kvx.tgz https://github.com/kalray/build-scripts/releases/download/v5.0.0/gcc-kalray-kvx-ubuntu-22.04-v5.0.0.tar.gz
-
-RUN echo "d27b3d6e6246f5debffee0bb01e77eb133bd32c658782a68a779cf9fb4c436bc kvx.tgz" | \
-    sha256sum --check --status
-
-RUN tar -C /opt -xzf kvx.tgz && rm kvx.tgz
+RUN tgz_checksum_dl() { set -e; wget -nv -O archive.tgz "$1"; \
+                        echo "$2 archive.tgz" | sha256sum --check --status; tar -C /opt -xzf archive.tgz; rm archive.tgz; } && \
+    tgz_checksum_dl https://github.com/kalray/build-scripts/releases/download/v5.0.0/gcc-kalray-kvx-ubuntu-22.04-v5.0.0.tar.gz \
+                    d27b3d6e6246f5debffee0bb01e77eb133bd32c658782a68a779cf9fb4c436bc
 
 RUN wget -nv "https://github.com/qemu/qemu/blob/v5.2.0/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin?raw=true" -O /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin
 
-- 
2.39.5




More information about the barebox mailing list