Skip to content

Commit

Permalink
install tar if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinsonneau committed Oct 21, 2024
1 parent e8eba62 commit 4e6199b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ COPY .mk/ .mk/
# Build collector
RUN GOARCH=$TARGETARCH make compile

# Install oc to allow collector to run commands
RUN set -x; \
OC_TAR_URL="https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/latest/openshift-client-linux.tar.gz" && \
curl -L -q -o /tmp/oc.tar.gz "$OC_TAR_URL" && \
tar -C /tmp -xvf /tmp/oc.tar.gz oc kubectl

# Embedd commands in case users want to pull it from collector image
RUN USER=netobserv VERSION=main make oc-commands

Expand All @@ -34,15 +40,10 @@ RUN mkdir -p output
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi:9.4
WORKDIR /

# Install oc to allow collector to run commands
RUN set -x; \
OC_TAR_URL="https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/latest/openshift-client-linux.tar.gz" && \
curl -L -q -o /tmp/oc.tar.gz "$OC_TAR_URL" && \
tar -C /usr/bin/ -xvf /tmp/oc.tar.gz oc && \
ln -sf /usr/bin/oc /usr/bin/kubectl && \
rm -f /tmp/oc.tar.gz

COPY --from=builder /opt/app-root/build .
COPY --from=builder /opt/app-root/build .
COPY --from=builder /tmp/oc /usr/bin/oc
COPY --from=builder /tmp/kubectl /usr/bin/kubectl
COPY --from=builder --chown=65532:65532 /opt/app-root/output /output
USER 65532:65532

Expand Down

0 comments on commit 4e6199b

Please sign in to comment.