Skip to content

Commit

Permalink
Fix BUILDPLATFORM redefinition issue in non-OpenShift 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, which is more lenient with
ARG redefinitions.

Fixes: bpfman#120

Signed-off-by: Andrew McDermott <[email protected]>
  • Loading branch information
frobware committed Sep 5, 2024
1 parent 076e261 commit 7b708a9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 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 Down
2 changes: 1 addition & 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 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
4 changes: 1 addition & 3 deletions Containerfile.bpfman-operator.openshift
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# 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

ARG BUILDPLATFORM

# The following ARGs are set internally by docker/build-push-action in github actions
ARG TARGETOS
ARG TARGETARCH
Expand Down

0 comments on commit 7b708a9

Please sign in to comment.