U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>
Subject: [v6 07/12] docker: Use cache mounts for apt
Date: Wed, 27 Nov 2024 11:17:25 -0600	[thread overview]
Message-ID: <20241127172247.1488685-8-trini@konsulko.com> (raw)
In-Reply-To: <20241127172247.1488685-1-trini@konsulko.com>

Instead of deleting /var/lib/apt/lists after each relevant RUN line, use
a cache mount as is the current best practices.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v6:
- New patch
---
 tools/docker/Dockerfile | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 90c90bd05f0b..bc8d1ebbb1e8 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -10,7 +10,9 @@ LABEL org.opencontainers.image.description=" This image is for building U-Boot i
 ENV DEBIAN_FRONTEND=noninteractive
 
 # Add LLVM repository
-RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
+RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
+    --mount=type=cache,target=/var/lib/apt,sharing=locked \
+    apt-get update && apt-get install -y gnupg2 wget xz-utils
 RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
 RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main | tee /etc/apt/sources.list.d/llvm.list
 
@@ -33,7 +35,9 @@ RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_
 RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-2020.07-xtensa-dc233c-elf.tar.gz | tar -C /opt -xz
 
 # Update and install things from apt now
-RUN apt-get update && apt-get install -y \
+RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
+    --mount=type=cache,target=/var/lib/apt,sharing=locked \
+    apt-get update && apt-get install -y \
 	automake \
 	autopoint \
 	bc \
@@ -118,8 +122,7 @@ RUN apt-get update && apt-get install -y \
 	vboot-utils \
 	xilinx-bootgen \
 	xxd \
-	zip \
-	&& rm -rf /var/lib/apt/lists/*
+	zip
 
 # Make kernels readable for libguestfs tools to work correctly
 RUN chmod +r /boot/vmlinu*
-- 
2.43.0


  parent reply	other threads:[~2024-11-27 17:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 17:17 [v6 0/12] CI: Set up for an arm64 runner Tom Rini
2024-11-27 17:17 ` [v6 01/12] sandbox: efi_loader: Correct use of addresses as pointers Tom Rini
2024-11-27 18:40   ` Heinrich Schuchardt
2024-11-27 18:51     ` Tom Rini
2024-11-27 19:13       ` Heinrich Schuchardt
2024-11-27 19:38     ` Heinrich Schuchardt
2024-11-27 21:09     ` Simon Glass
2024-11-27 21:14       ` Tom Rini
2024-11-30 20:24         ` Simon Glass
2024-11-27 17:17 ` [v6 02/12] test: Adjust print_ut test to use unsigned char Tom Rini
2024-11-27 17:17 ` [v6 03/12] docker: Add kernel.org x86_64 toolchain Tom Rini
2024-11-28 15:45   ` Simon Glass
2024-11-27 17:17 ` [v6 04/12] docker: Use "make -j$(nproc)" when invoking make Tom Rini
2024-11-28 15:45   ` Simon Glass
2024-11-27 17:17 ` [v6 05/12] docker: Update to grub-2.12 Tom Rini
2024-11-28 15:45   ` Simon Glass
2024-11-27 17:17 ` [v6 06/12] docker: Build grub for all architectures Tom Rini
2024-11-28 15:45   ` Simon Glass
2024-11-27 17:17 ` Tom Rini [this message]
2024-11-28 15:45   ` [v6 07/12] docker: Use cache mounts for apt Simon Glass
2024-11-27 17:17 ` [v6 08/12] docker: Support building for multiple architectures Tom Rini
2024-11-27 17:17 ` [v6 09/12] docker: Adjust installed packages slightly Tom Rini
2024-11-27 17:17 ` [v6 10/12] docker: Fix LegacyKeyValueFormat warning with PYTHONPATH Tom Rini
2024-11-27 17:17 ` [v6 11/12] docker: Install toolchains on arm64 host Tom Rini
2024-11-27 17:17 ` [v6 12/12] CI: Add platform variable Tom Rini
2024-12-03 19:57 ` [v6 0/12] CI: Set up for an arm64 runner Tom Rini
2024-12-17 19:45   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241127172247.1488685-8-trini@konsulko.com \
    --to=trini@konsulko.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox