Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][Kubectl] feat : build arm64 docker images #881

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Versions
========

2022-09-31
----------
* Kubectl : build arm64 docker image


2022-08-31
----------

Expand Down
69 changes: 39 additions & 30 deletions kubectl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM alpine:3.16.2
FROM alpine:3.16.2 as base
LABEL maintainer="opensource@ekino.com"

ARG HELM_DIFF_VERSION
ARG HELM_VERSION
ARG KUBECTL_VERSION
Expand All @@ -9,18 +8,35 @@ ARG KUBESCORE_VERSION
ARG KUBEVAL_VERSION
ARG KUSTOMIZATION_VERSION
ARG TRIVY_VERSION

ENV PATH="${PATH}:/usr/bin"

FROM base as base-amd64
ARG KUBECTL_ARCH="linux/amd64"
ARG AWSCLI_ARCH="linux-x86_64"
ARG KUSTOMIZATION_ARCH="linux_amd64"
ARG KUBESCORE_ARCH="linux_amd64"
ARG KUBENT_ARCH="linux-amd64"
ARG KUBEVAL_ARCH="linux_amd64"
ARG HELM_ARCH="linux-amd64"
ARG TRIVY_ARCH="Linux-64bit"

FROM base as base-arm64
ARG KUBECTL_ARCH="linux/arm64"
ARG AWSCLI_ARCH="linux-aarch64"
ARG KUSTOMIZATION_ARCH="linux_arm64"
ARG KUBESCORE_ARCH="linux_arm64"
ARG KUBENT_ARCH="linux-arm64"
ARG KUBEVAL_ARCH="linux_arm64"
ARG HELM_ARCH="linux-arm64"
ARG TRIVY_ARCH="Linux-ARM64"

FROM base-${TARGETARCH}
RUN apk add ca-certificates curl bash wget groff less ncurses unzip && \
curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/${KUBECTL_ARCH}/kubectl && \
chmod +x ./kubectl && \
mv ./kubectl /usr/bin/kubectl


# install glibc & aws compatibility for alpine
ENV GLIBC_VER=2.31-r0

# install glibc compatibility for alpine
RUN apk --no-cache add \
binutils \
Expand All @@ -34,9 +50,9 @@ RUN apk --no-cache add \
glibc-bin-${GLIBC_VER}.apk \
glibc-i18n-${GLIBC_VER}.apk \
&& /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 \
&& curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
&& curl https://awscli.amazonaws.com/awscli-exe-${AWSCLI_ARCH}.zip -o awscliv2.zip \
&& unzip awscliv2.zip \
&& aws/install \
&& ./aws/install \
&& rm -rf \
awscliv2.zip \
aws \
Expand All @@ -49,30 +65,23 @@ RUN apk --no-cache add \
binutils \
curl \
&& rm -rf /var/cache/apk/*

RUN wget https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZATION_VERSION}/kustomize_v${KUSTOMIZATION_VERSION}_linux_amd64.tar.gz && \
tar -xf kustomize_v${KUSTOMIZATION_VERSION}_linux_amd64.tar.gz && \
RUN wget https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZATION_VERSION}/kustomize_v${KUSTOMIZATION_VERSION}_${KUSTOMIZATION_ARCH}.tar.gz && \
tar -xf kustomize_v${KUSTOMIZATION_VERSION}_${KUSTOMIZATION_ARCH}.tar.gz && \
mv ./kustomize /usr/bin/kustomize

RUN wget https://github.com/zegl/kube-score/releases/download/v${KUBESCORE_VERSION}/kube-score_${KUBESCORE_VERSION}_linux_amd64 && \
chmod +x kube-score_${KUBESCORE_VERSION}_linux_amd64 && \
mv kube-score_${KUBESCORE_VERSION}_linux_amd64 /usr/bin/kube-score

RUN wget https://github.com/doitintl/kube-no-trouble/releases/download/${KUBENT_VERSION}/kubent-${KUBENT_VERSION}-linux-amd64.tar.gz && \
tar xf kubent-${KUBENT_VERSION}-linux-amd64.tar.gz && \
RUN wget https://github.com/zegl/kube-score/releases/download/v${KUBESCORE_VERSION}/kube-score_${KUBESCORE_VERSION}_${KUBESCORE_ARCH} && \
chmod +x kube-score_${KUBESCORE_VERSION}_${KUBESCORE_ARCH} && \
mv kube-score_${KUBESCORE_VERSION}_${KUBESCORE_ARCH} /usr/bin/kube-score
RUN wget https://github.com/doitintl/kube-no-trouble/releases/download/${KUBENT_VERSION}/kubent-${KUBENT_VERSION}-${KUBENT_ARCH}.tar.gz && \
tar xf kubent-${KUBENT_VERSION}-${KUBENT_ARCH}.tar.gz && \
mv kubent /usr/bin/kubent

RUN wget https://github.com/instrumenta/kubeval/releases/download/v${KUBEVAL_VERSION}/kubeval-linux-amd64.tar.gz && \
tar xf kubeval-linux-amd64.tar.gz && \
RUN wget https://github.com/jenkins-x-plugins/kubeval/releases/download/v${KUBEVAL_VERSION}/kubeval_${KUBEVAL_VERSION}_${KUBEVAL_ARCH}.tar.gz && \
tar xf kubeval_${KUBEVAL_VERSION}_${KUBEVAL_ARCH}.tar.gz && \
mv kubeval /usr/local/bin/kubeval

RUN wget https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
tar xf helm-v${HELM_VERSION}-linux-amd64.tar.gz && rm helm-v${HELM_VERSION}-linux-amd64.tar.gz && \
mv linux-amd64/helm /usr/local/bin/helm

RUN wget https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz && \
tar xf trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz && \
RUN wget https://get.helm.sh/helm-v${HELM_VERSION}-${HELM_ARCH}.tar.gz && \
tar xf helm-v${HELM_VERSION}-${HELM_ARCH}.tar.gz && rm helm-v${HELM_VERSION}-${HELM_ARCH}.tar.gz && \
mv ${HELM_ARCH}/helm /usr/local/bin/helm
RUN wget https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_${TRIVY_ARCH}.tar.gz && \
tar xf trivy_${TRIVY_VERSION}_${TRIVY_ARCH}.tar.gz && \
mv trivy /usr/bin/trivy

RUN apk add git && \
helm plugin install --version $HELM_DIFF_VERSION https://github.com/databus23/helm-diff
6 changes: 4 additions & 2 deletions kubectl/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
versions:
"1.24":
platforms: *base_platforms
platforms:
- linux/amd64
- linux/arm64
test_config:
cmd:
- kube-score version
Expand All @@ -17,6 +19,6 @@ versions:
KUBECTL_VERSION: 1.24.0
KUBENT_VERSION: 0.5.1
KUBESCORE_VERSION: 1.14.0
KUBEVAL_VERSION: 0.16.1
KUBEVAL_VERSION: 0.16.7
KUSTOMIZATION_VERSION: 4.5.5
TRIVY_VERSION: "0.28.1"