From 207a7c3694e5408a355dbc28924690cce52ebde8 Mon Sep 17 00:00:00 2001 From: Soule BA Date: Mon, 21 Oct 2024 13:35:37 +0200 Subject: [PATCH] chore: Use bitnami docker image for kubectl Signed-off-by: Soule BA --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0a9a1b50..f2d5aff7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,13 +19,9 @@ ARG ARCH FROM golang:1.23@sha256:540d3442f4758da82e787d03930bf6468cf6f8613474135e8946259b9e531ea0 AS builder WORKDIR /workspace -# Add kubectl tool + # Using the $ARCH in the name of the binary here ensures we don't get any cross-arch caching after this binary is downloaded. ARG ARCH -# kubectl latest version can be retrieved by curl -L -s https://dl.k8s.io/release/stable.txt -ARG KUBECTL_VERSION=v1.31.1 -RUN curl -L "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" -o kubectl-${ARCH} && \ - chmod +x ./kubectl-${ARCH} # Copy the Go Modules manifests COPY go.mod go.mod @@ -51,15 +47,19 @@ RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags="${LDFLAGS}" -gcflags="${GCFLAGS}" -o manager main.go +FROM --platform=linux/${ARCH} bitnami/kubectl:1.31.1 AS kubectl + FROM --platform=linux/${ARCH} registry.access.redhat.com/ubi8-micro:8.10 ARG ARCH WORKDIR / COPY --from=builder /workspace/manager . -COPY --from=builder /workspace/kubectl-${ARCH} /usr/local/bin/kubectl COPY --from=builder /workspace/crds /crds +# Copy the kubectl binary +COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/ + # Default Certificates are missing in micro-ubi. These are need to fetch DOCA drivers image tags COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem COPY /webhook-schemas /webhook-schemas