From fc3727da52cfa4cf8b945690a4a103725bb05cb3 Mon Sep 17 00:00:00 2001 From: Olivier Cazade <ocazade@redhat.com> Date: Wed, 12 Feb 2025 11:48:22 +0100 Subject: [PATCH] Align downstream dockerfile with the upstream one (#560) * Align downstream dockerfile with the upstream one (#557) * Align downstream dockerfile with the upstream one * Update Dockerfile.downstream Co-authored-by: Julien Pinsonneau <91894519+jpinsonneau@users.noreply.github.com> --------- Co-authored-by: Julien Pinsonneau <91894519+jpinsonneau@users.noreply.github.com> * Fix arg usage for downstream builds (#558) --------- Co-authored-by: Julien Pinsonneau <91894519+jpinsonneau@users.noreply.github.com> --- Dockerfile.downstream | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile.downstream b/Dockerfile.downstream index 9b4b5623..fda16938 100644 --- a/Dockerfile.downstream +++ b/Dockerfile.downstream @@ -1,27 +1,30 @@ +ARG TARGETARCH +ARG COMMIT + # Build the manager binary -FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.23 as builder +FROM --platform=linux/$TARGETARCH brew.registry.redhat.io/rh-osbs/openshift-golang-builder:v1.23 as builder -ARG VERSION="unknown" +ARG TARGETARCH=amd64 +ARG BUILDVERSION="1.8.0" ARG COMMIT WORKDIR /opt/app-root # Copy the go manifests and source -COPY .git/ .git/ COPY bpf/ bpf/ COPY cmd/ cmd/ COPY pkg/ pkg/ COPY vendor/ vendor/ COPY go.mod go.mod COPY go.sum go.sum -COPY Makefile Makefile -COPY .mk/ .mk/ # Build -RUN make compile +RUN GOARCH=$TARGETARCH go build -ldflags "-X 'main.buildVersion=${BUILDVERSION}' -X 'main.buildDate=`date +%Y-%m-%d\ %H:%M`'" -mod vendor -a -o bin/netobserv-ebpf-agent cmd/netobserv-ebpf-agent.go # Create final image from minimal + built binary -FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5-1738816775 +FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.5-1738816775 +ARG COMMIT + WORKDIR / COPY --from=builder /opt/app-root/bin/netobserv-ebpf-agent . USER 65532:65532 @@ -35,7 +38,7 @@ LABEL io.k8s.description="Network Observability eBPF Agent" LABEL summary="Network Observability eBPF Agent" LABEL maintainer="support@redhat.com" LABEL io.openshift.tags="network-observability-ebpf-agent" -LABEL upstream-vcs-ref="$COMMIT" +LABEL upstream-vcs-ref=$COMMIT LABEL upstream-vcs-type="git" LABEL description="The Network Observability eBPF Agent allows collecting and aggregating all the ingress and egress flows on a Linux host." -LABEL version="1.8.0" +LABEL version=$BUILDVERSION -- GitLab