FROM debian:12-slim as kubectl RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ curl \ git \ && rm -rf /var/lib/apt/lists/* ENV K8S_VERSION=v1.27 RUN V="$(git ls-remote --tags --refs --sort=version:refname https://github.com/kubernetes/kubernetes "$K8S_VERSION.*" | awk -F/ 'END{print $NF}')" \ && curl -Lo /kubectl "https://dl.k8s.io/release/$V/bin/linux/amd64/kubectl" FROM debian:12-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ gettext-base \ git \ jq \ && rm -rf /var/lib/apt/lists/* COPY --from=kubectl --chmod=0755 /kubectl /usr/local/bin/