From e6afa5f51e13a873bc9d078b7667412cc487805a Mon Sep 17 00:00:00 2001 From: Steven Linn Date: Fri, 23 Feb 2024 09:29:15 -0700 Subject: [PATCH] Update Dockerfile to support arm, arm64 and amd64 architecture --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index aefd66d..bb4d623 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ FROM alpine:3.17 MAINTAINER Serhiy Mitrovtsiy +ARG TARGETPLATFORM ARG KUBE_VERSION="v1.29.2" COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh && \ +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then ARCHITECTURE=amd64; elif [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then ARCHITECTURE=arm; elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCHITECTURE=arm64; else ARCHITECTURE=amd64; fi && \ + chmod +x /entrypoint.sh && \ apk add --no-cache --update openssl curl ca-certificates && \ - curl -L https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && \ + curl -L https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/$ARCHITECTURE/kubectl -o /usr/local/bin/kubectl && \ chmod +x /usr/local/bin/kubectl && \ rm -rf /var/cache/apk/*