diff --git a/containers/kiwix-serve/Dockerfile b/containers/kiwix-serve/Dockerfile index c656c30..37255a4 100644 --- a/containers/kiwix-serve/Dockerfile +++ b/containers/kiwix-serve/Dockerfile @@ -8,13 +8,27 @@ ARG KIWIX_VERSION=3.8.1 RUN set -e && \ apk --no-cache add dumb-init curl && \ - echo "TARGETPLATFORM: $TARGETPLATFORM" && \ - if [ "$TARGETPLATFORM" = "linux/arm64/v8" -o "$TARGETPLATFORM" = "linux/arm64" ]; then \ - ARCH="aarch64"; \ - elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ - ARCH="x86_64"; \ + # Detect architecture - use TARGETPLATFORM if set, otherwise detect from uname + if [ -n "$TARGETPLATFORM" ]; then \ + echo "TARGETPLATFORM: $TARGETPLATFORM"; \ + case "$TARGETPLATFORM" in \ + linux/arm64*) ARCH="aarch64" ;; \ + linux/amd64*) ARCH="x86_64" ;; \ + *) ARCH="" ;; \ + esac; \ else \ - ARCH="unknown"; \ + echo "TARGETPLATFORM not set, detecting from uname..."; \ + UNAME_ARCH=$(uname -m); \ + echo "uname -m: $UNAME_ARCH"; \ + case "$UNAME_ARCH" in \ + aarch64|arm64) ARCH="aarch64" ;; \ + x86_64) ARCH="x86_64" ;; \ + *) ARCH="" ;; \ + esac; \ + fi && \ + if [ -z "$ARCH" ]; then \ + echo "ERROR: Unsupported architecture"; \ + exit 1; \ fi && \ url="http://mirror.download.kiwix.org/release/kiwix-tools/kiwix-tools_linux-$ARCH-$KIWIX_VERSION.tar.gz" && \ echo "URL: $url" && \ diff --git a/containers/kubectl/Dockerfile b/containers/kubectl/Dockerfile index 745efe6..31a2536 100644 --- a/containers/kubectl/Dockerfile +++ b/containers/kubectl/Dockerfile @@ -7,7 +7,19 @@ ARG TARGETARCH ARG KUBECTL_VERSION=v1.34.1 RUN apk add --no-cache curl && \ - curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" && \ + # 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 FROM alpine:3.21