Skip to content

Instantly share code, notes, and snippets.

@tuffacton
Last active August 14, 2024 21:34
Show Gist options
  • Select an option

  • Save tuffacton/80c8d32519a4bcb1d59608d0651a8981 to your computer and use it in GitHub Desktop.

Select an option

Save tuffacton/80c8d32519a4bcb1d59608d0651a8981 to your computer and use it in GitHub Desktop.
Adding kubectl to moby/buildkit:master-rootless
# Add kubectl to the Docker container
FROM alpine:latest AS kubectl
# Specify the kubectl version to download
ARG KUBECTL_VERSION=v1.28.2
# Install kubectl
RUN apk add --no-cache curl && \
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/$(uname -m)/kubectl" && \
chmod +x kubectl && \
mv kubectl /usr/local/bin/
# Copy kubectl into the main image
FROM moby/buildkit:master-rootless AS final-image
COPY --from=kubectl /usr/local/bin/kubectl /usr/local/bin/kubectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment