2026-01-25 21:35:57 -08:00
|
|
|
# Minimal kubectl container
|
|
|
|
|
# Multi-arch build: downloads correct binary for target platform
|
|
|
|
|
|
2026-02-20 22:50:01 -08:00
|
|
|
ARG CONTAINER_APP_VERSION=v1.34.4
|
|
|
|
|
|
2026-02-13 17:16:37 -08:00
|
|
|
FROM alpine:3.22 AS downloader
|
2026-01-25 21:35:57 -08:00
|
|
|
|
|
|
|
|
ARG TARGETARCH
|
2026-02-20 22:50:01 -08:00
|
|
|
ARG CONTAINER_APP_VERSION
|
|
|
|
|
ARG KUBECTL_VERSION=${CONTAINER_APP_VERSION}
|
2026-01-25 21:35:57 -08:00
|
|
|
|
|
|
|
|
RUN apk add --no-cache curl && \
|
|
|
|
|
# Detect architecture - use TARGETARCH if set, otherwise detect from uname
|
|
|
|
|
if [ -n "$TARGETARCH" ]; then \
|
|
|
|
|
ARCH="$TARGETARCH"; \
|
|
|
|
|
else \
|
|
|
|
|
UNAME_ARCH=$(uname -m); \
|
|
|
|
|
case "$UNAME_ARCH" in \
|
|
|
|
|
aarch64|arm64) ARCH="arm64" ;; \
|
|
|
|
|
x86_64) ARCH="amd64" ;; \
|
|
|
|
|
*) echo "Unsupported architecture: $UNAME_ARCH"; exit 1 ;; \
|
|
|
|
|
esac; \
|
|
|
|
|
fi && \
|
|
|
|
|
echo "Downloading kubectl for $ARCH..." && \
|
|
|
|
|
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl" && \
|
|
|
|
|
chmod +x kubectl
|
|
|
|
|
|
2026-02-13 17:16:37 -08:00
|
|
|
FROM alpine:3.22
|
2026-01-25 21:35:57 -08:00
|
|
|
|
2026-03-18 20:42:00 -07:00
|
|
|
ARG CONTAINER_APP_VERSION
|
|
|
|
|
LABEL org.opencontainers.image.title="kubectl"
|
|
|
|
|
LABEL org.opencontainers.image.description="Minimal kubectl container"
|
|
|
|
|
LABEL org.opencontainers.image.version="${CONTAINER_APP_VERSION}"
|
|
|
|
|
LABEL org.opencontainers.image.source="https://forge.eblu.me/eblume/blumeops"
|
|
|
|
|
LABEL org.opencontainers.image.vendor="blumeops"
|
|
|
|
|
|
2026-01-25 21:35:57 -08:00
|
|
|
COPY --from=downloader /kubectl /usr/local/bin/kubectl
|
|
|
|
|
|
|
|
|
|
# Add ca-certificates for HTTPS connections and bash for scripts
|
|
|
|
|
RUN apk add --no-cache ca-certificates bash
|
|
|
|
|
|
|
|
|
|
# Run as non-root
|
|
|
|
|
RUN adduser -D -u 1000 kubectl
|
|
|
|
|
USER kubectl
|
|
|
|
|
|
|
|
|
|
ENTRYPOINT ["kubectl"]
|