Skip to content

Commit

Permalink
Fix BUILDPLATFORM redefinition issue in some Containerfiles
Browse files Browse the repository at this point in the history
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: bpfman#120

Signed-off-by: Andrew McDermott <[email protected]>
  • Loading branch information
frobware committed Sep 6, 2024
1 parent c686cd1 commit 58712f0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Containerfile.bpfman-agent
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Containerfile.bpfman-agent.openshift
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Containerfile.bpfman-operator
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion Containerfile.bpfman-operator.openshift
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 58712f0

Please sign in to comment.