Skip to content

Commit

Permalink
feat: Use ose-tools to get kubectl
Browse files Browse the repository at this point in the history
  • Loading branch information
flacatus committed Sep 12, 2024
1 parent a913920 commit 5ddcd2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .tekton/rhtap-cli-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ spec:
description: Skip checks against built image
name: skip-checks
type: string
- default: "false"
- default: "true"
description: Execute the build with network isolation
name: hermetic
type: string
Expand Down
2 changes: 1 addition & 1 deletion .tekton/rhtap-cli-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec:
description: Skip checks against built image
name: skip-checks
type: string
- default: "false"
- default: "true"
description: Execute the build with network isolation
name: hermetic
type: string
Expand Down
24 changes: 9 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Build
#

FROM registry.redhat.io/openshift4/ose-tools-rhel9:latestt@sha256:c2a2eca448a2e1b5d73f88dcd12a6c87e5f4580512303f4e38b67acf810b4778 as ose-tools
FROM registry.access.redhat.com/ubi9/go-toolset:latest AS builder

USER root

WORKDIR /workdir/rhtap-cli

COPY installer/ ./installer/
Expand Down Expand Up @@ -41,25 +41,19 @@ LABEL \

WORKDIR /rhtap-cli

COPY --from=ose-tools /usr/bin/kubectl /usr/bin/

COPY --from=builder /workdir/rhtap-cli/installer ./

COPY --from=builder /workdir/rhtap-cli/bin/rhtap-cli /usr/local/bin/rhtap-cli
COPY --from=builder /usr/bin/tar /usr/bin/
COPY --from=builder /usr/bin/gzip /usr/bin/

RUN microdnf install -y gzip shadow-utils tar && \
groupadd --gid 1000 -r rhtap-cli && \
useradd -r -d /rhtap-cli -g rhtap-cli -s /sbin/nologin --uid 1000 rhtap-cli && \
ARCH=$(uname -m) && \
KUBECTL_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt) && \
if [ "$ARCH" = "x86_64" ]; then \
curl --proto "=https" --tlsv1.2 -sSf -L -O "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"; \
elif [ "$ARCH" = "aarch64" ]; then \
curl --proto "=https" --tlsv1.2 -sSf -L -O "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/arm64/kubectl"; \
fi && \
chmod +x kubectl && \
mv kubectl /usr/bin/kubectl && \
microdnf remove -y shadow-utils && \
microdnf clean all
RUN groupadd --gid 1000 -r rhtap-cli && \
useradd -r -d /rhtap-cli -g rhtap-cli -s /sbin/nologin --uid 1000 rhtap-cli

USER rhtap-cli

RUN kubectl version --client

ENTRYPOINT ["rhtap-cli"]

0 comments on commit 5ddcd2a

Please sign in to comment.