From 58712f0724118532bda92c5b0c4be993252d46d5 Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Mon, 2 Sep 2024 08:38:44 +0100 Subject: [PATCH] Fix BUILDPLATFORM redefinition issue in some Containerfiles Removed the hardcoded `ARG BUILDPLATFORM=linux/amd64` from `Containerfile.bpfman-agent{.openshift}` and `Containerfile.bpfman-operator{.openshift}`. This change addresses an issue where Podman fails to build the images if `BUILDPLATFORM` is redefined. By removing the redefinition, the build process is made compatible with Podman. This change remains compatible with Docker. Fixes: https://github.com/bpfman/bpfman-operator/issues/120 Signed-off-by: Andrew McDermott --- Containerfile.bpfman-agent | 4 +++- Containerfile.bpfman-agent.openshift | 4 +++- Containerfile.bpfman-operator | 2 +- Containerfile.bpfman-operator.openshift | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Containerfile.bpfman-agent b/Containerfile.bpfman-agent index 2d15b01f2..c0141698f 100644 --- a/Containerfile.bpfman-agent +++ b/Containerfile.bpfman-agent @@ -1,5 +1,5 @@ # Build the manager binary -ARG BUILDPLATFORM=linux/amd64 +ARG BUILDPLATFORM FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 AS bpfman-agent-build @@ -8,6 +8,8 @@ ARG TARGETOS ARG TARGETARCH ARG TARGETPLATFORM +ARG BUILDPLATFORM + RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}" WORKDIR /usr/src/bpfman-operator diff --git a/Containerfile.bpfman-agent.openshift b/Containerfile.bpfman-agent.openshift index 49cded6b9..d2b65418a 100644 --- a/Containerfile.bpfman-agent.openshift +++ b/Containerfile.bpfman-agent.openshift @@ -1,5 +1,5 @@ # Build the manager binary -ARG BUILDPLATFORM=linux/amd64 +ARG BUILDPLATFORM FROM --platform=$BUILDPLATFORM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.22.5-202407301806.g4c8b32d.el9 AS bpfman-agent-build @@ -8,6 +8,8 @@ ARG TARGETOS ARG TARGETARCH ARG TARGETPLATFORM +ARG BUILDPLATFORM + RUN echo "TARGETOS=${TARGETOS} TARGETARCH=${TARGETARCH} BUILDPLATFORM=${BUILDPLATFORM} TARGETPLATFORM=${TARGETPLATFORM}" WORKDIR /usr/src/bpfman-operator diff --git a/Containerfile.bpfman-operator b/Containerfile.bpfman-operator index 3d4a9f708..d1635b3fa 100644 --- a/Containerfile.bpfman-operator +++ b/Containerfile.bpfman-operator @@ -1,5 +1,5 @@ # Build the manager binary -ARG BUILDPLATFORM=linux/amd64 +ARG BUILDPLATFORM FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 AS bpfman-operator-build diff --git a/Containerfile.bpfman-operator.openshift b/Containerfile.bpfman-operator.openshift index 07857c6ab..50c175c54 100644 --- a/Containerfile.bpfman-operator.openshift +++ b/Containerfile.bpfman-operator.openshift @@ -1,5 +1,5 @@ # Build the manager binary -ARG BUILDPLATFORM=linux/amd64 +ARG BUILDPLATFORM FROM --platform=$BUILDPLATFORM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.22.5-202407301806.g4c8b32d.el9 AS bpfman-operator-build