[llvm] [github] remove more caches after downloading things (PR #133129)

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 26 10:30:19 PDT 2025


https://github.com/gburgessiv created https://github.com/llvm/llvm-project/pull/133129

This is generally good practice if the caches won't be reused (though arguably pedantic for the `stage1-toolchain` stage).

`docker history` on comparable images showed that this saves a few hundred MB on stage1, and ~60MB on the `apt-get` layer of `ci-container-agent`.

>From f5de92b6fa0801b1a4f96ce314a9e03d834b52eb Mon Sep 17 00:00:00 2001
From: George Burgess IV <george.burgess.iv at gmail.com>
Date: Wed, 26 Mar 2025 10:40:49 -0600
Subject: [PATCH] [github] remove more caches after downloading things

This is generally good practice if the caches won't be reused (though
arguably pedantic for the `stage1-toolchain` stage).

`docker history` on comparable images showed that this saves a few
hundred MB on stage1, and ~60MB on the `apt-get` layer of
`ci-container-agent`.
---
 .../workflows/containers/github-action-ci/Dockerfile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile
index bd3720017b7f7..11e020ad6ebef 100644
--- a/.github/workflows/containers/github-action-ci/Dockerfile
+++ b/.github/workflows/containers/github-action-ci/Dockerfile
@@ -14,9 +14,13 @@ RUN apt-get update && \
     python3 \
     git \
     curl \
-    zlib1g-dev
+    zlib1g-dev && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
 
-RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz
+RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && \
+  tar -xf llvmorg-$LLVM_VERSION.tar.gz && \
+  rm -f llvmorg-$LLVM_VERSION.tar.gz
 
 WORKDIR /llvm-project-llvmorg-$LLVM_VERSION
 
@@ -65,7 +69,9 @@ RUN apt-get update && \
     python3-pip \
     ccache \
     file \
-    tzdata
+    tzdata && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists/*
 
 # Install sccache as it is needed by most of the project test workflows and
 # cannot be installed by the ccache action when executing as a non-root user.



More information about the llvm-commits mailing list