diff mbox series

[3/9] docker: Support building for multiple architectures

Message ID 20241104133954.840994-4-sjg@chromium.org
State Changes Requested
Delegated to: Tom Rini
Headers show
Series CI: Set up for an arm64 runner | expand

Commit Message

Simon Glass Nov. 4, 2024, 1:39 p.m. UTC
Add instructions on how to build the file for multiple architectures.
Add a message indicating what is happening.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/docker/Dockerfile | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Tom Rini Nov. 4, 2024, 1:55 p.m. UTC | #1
On Mon, Nov 04, 2024 at 06:39:47AM -0700, Simon Glass wrote:

> Add instructions on how to build the file for multiple architectures.
> Add a message indicating what is happening.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  tools/docker/Dockerfile | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> index 967ac89fbde..c9d794082c8 100644
> --- a/tools/docker/Dockerfile
> +++ b/tools/docker/Dockerfile
> @@ -2,6 +2,9 @@
>  # This Dockerfile is used to build an image containing basic stuff to be used
>  # to build U-Boot and run our test suites.
>  
> +# Build with (for example):
> +# docker buildx build --platform linux/arm64/v8,linux/amd64 --tag sjg20/u-boot-gitlab-ci-runner-multiarch:jammy-20240808-03Nov2024 .
> +
>  FROM ubuntu:jammy-20240808
>  LABEL org.opencontainers.image.authors="Tom Rini <trini@konsulko.com>"
>  LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container"
> @@ -9,6 +12,10 @@ LABEL org.opencontainers.image.description=" This image is for building U-Boot i
>  # Make sure apt is happy
>  ENV DEBIAN_FRONTEND=noninteractive
>  
> +ARG TARGETPLATFORM
> +ARG BUILDPLATFORM
> +RUN echo "Building $BUILDPLATFORM, for target $TARGETPLATFORM"
> +
>  # Add LLVM repository
>  RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
>  RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -

Please update doc/build/docker.rst as well with this change, thanks.
Heinrich Schuchardt Nov. 4, 2024, 8:49 p.m. UTC | #2
Am 4. November 2024 14:39:47 MEZ schrieb Simon Glass <sjg@chromium.org>:
>Add instructions on how to build the file for multiple architectures.
>Add a message indicating what is happening.
>
>Signed-off-by: Simon Glass <sjg@chromium.org>
>---
>
> tools/docker/Dockerfile | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
>index 967ac89fbde..c9d794082c8 100644
>--- a/tools/docker/Dockerfile
>+++ b/tools/docker/Dockerfile
>@@ -2,6 +2,9 @@
> # This Dockerfile is used to build an image containing basic stuff to be used
> # to build U-Boot and run our test suites.
> 
>+# Build with (for example):
>+# docker buildx build --platform linux/arm64/v8,linux/amd64 --tag sjg20/u-boot-gitlab-ci-runner-multiarch:jammy-20240808-03Nov2024 .
>+
> FROM ubuntu:jammy-20240808
> LABEL org.opencontainers.image.authors="Tom Rini <trini@konsulko.com>"
> LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container"
>@@ -9,6 +12,10 @@ LABEL org.opencontainers.image.description=" This image is for building U-Boot i
> # Make sure apt is happy
> ENV DEBIAN_FRONTEND=noninteractive
> 
>+ARG TARGETPLATFORM
>+ARG BUILDPLATFORM

Please, add comments describing what these variables are used for.

Best regards

Heinrich

>+RUN echo "Building $BUILDPLATFORM, for target $TARGETPLATFORM"
>+
> # Add LLVM repository
> RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
> RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
diff mbox series

Patch

diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 967ac89fbde..c9d794082c8 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -2,6 +2,9 @@ 
 # This Dockerfile is used to build an image containing basic stuff to be used
 # to build U-Boot and run our test suites.
 
+# Build with (for example):
+# docker buildx build --platform linux/arm64/v8,linux/amd64 --tag sjg20/u-boot-gitlab-ci-runner-multiarch:jammy-20240808-03Nov2024 .
+
 FROM ubuntu:jammy-20240808
 LABEL org.opencontainers.image.authors="Tom Rini <trini@konsulko.com>"
 LABEL org.opencontainers.image.description=" This image is for building U-Boot inside a container"
@@ -9,6 +12,10 @@  LABEL org.opencontainers.image.description=" This image is for building U-Boot i
 # Make sure apt is happy
 ENV DEBIAN_FRONTEND=noninteractive
 
+ARG TARGETPLATFORM
+ARG BUILDPLATFORM
+RUN echo "Building $BUILDPLATFORM, for target $TARGETPLATFORM"
+
 # Add LLVM repository
 RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib/apt/lists/*
 RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -