Skip to content

Commit

Permalink
Fix podman builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Sep 18, 2024
1 parent 27cbe69 commit f4fc5d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
13 changes: 4 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker
ARG TARGETPLATFORM=linux/amd64
ARG BUILDPLATFORM=linux/amd64
ARG TARGETARCH=amd64
ARG TARGETARCH

# Build the manager binary
FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.22 as builder

FROM docker.io/library/golang:1.22 as builder

ARG TARGETARCH
ARG TARGETPLATFORM
ARG TARGETARCH=amd64
ARG VERSION="unknown"

WORKDIR /opt/app-root
Expand All @@ -28,7 +23,7 @@ COPY .mk/ .mk/
RUN GOARCH=$TARGETARCH make compile

# Create final image from minimal + built binary
FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi9/ubi-minimal:9.4
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.4
WORKDIR /
COPY --from=builder /opt/app-root/bin/netobserv-ebpf-agent .
USER 65532:65532
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ EXCLUDE_COVERAGE_FILES="(/cmd/)|(bpf_bpfe)|(/examples/)|(/pkg/pbflow/)"
# build a single arch target provided as argument
define build_target
echo 'building image for arch $(1)'; \
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETPLATFORM=linux/$(1) --build-arg TARGETARCH=$(1) --build-arg BUILDPLATFORM=linux/amd64 --build-arg GOVERSION="$(GO_VERSION)" ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f Dockerfile .;
DOCKER_BUILDKIT=1 $(OCI_BIN) buildx build --load --build-arg TARGETARCH=$(1) --build-arg GOVERSION="$(GO_VERSION)" ${OCI_BUILD_OPTS} -t ${IMAGE}-$(1) -f Dockerfile .;
endef

# push a single arch target image
Expand Down

0 comments on commit f4fc5d7

Please sign in to comment.