From dd56c5eb9d38b7e112d21e500b1b057bedf79e79 Mon Sep 17 00:00:00 2001 From: "bonnai.djicko" <@ekino.com> Date: Mon, 1 Aug 2022 10:29:56 +0200 Subject: [PATCH] [Dind] Fix : error "aws not found for amd64" from unit test "aws --version" --- CHANGELOG.md | 6 +++++- dind/Dockerfile | 48 ++++++++++++++++++++++++++++++++++-------------- dind/config.yml | 2 +- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7db4c6c03..77ad3b7dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Versions ======== +2023-07-30 +---------- +* Dind : build arm64 docker image + 2023-06-30 ---------- * PHP : update tools version (composer, PHP CS Fixer, Xdebug) @@ -55,6 +59,7 @@ Versions ---------- * Node: Adding jq command * Python : adding support for python 3.11 +* Dind : build arm64 docker image 2022-11-30 ---------- @@ -108,7 +113,6 @@ Versions * Python SRC Config : Add linux/amd64 and linux/arm64 as values for the new config property base_platforms * CI : use docker/setup-qemu-action@v2 and docker/setup-buildx-action@v2 as gitflows step actions * Images : Only [OCI images](https://github.com/opencontainers/image-spec/blob/main/spec.md) for amd64 architecture are built -* Dind : build arm64 docker image 2022-06-30 diff --git a/dind/Dockerfile b/dind/Dockerfile index 165418d33..2015358b6 100644 --- a/dind/Dockerfile +++ b/dind/Dockerfile @@ -6,14 +6,7 @@ ARG TRIVY_VERSION FROM base as base-amd64 ARG TRIVY_ARCH="Linux-64bit" -ARG AWSCLI_ARCH="x86_64" - -FROM base as base-arm64 -ARG TRIVY_ARCH="Linux-ARM64" -ARG AWSCLI_ARCH="aarch64" - -FROM base-$TARGETARCH -ARG AWSCLI_URL="https://awscli.amazonaws.com/awscli-exe-linux-${AWSCLI_ARCH}.zip" +ARG AWSCLI_ARCH="linux-x86_64" ADD requirements.txt . RUN echo "Install AWS & Azure CLIs" && \ apk add -q --no-cache bash build-base ca-certificates curl gettext git libffi-dev linux-headers musl-dev openldap-dev openssh-client python3-dev gcc libffi-dev libressl-dev make rsync tzdata groff zip && \ @@ -27,13 +20,40 @@ RUN echo "Install AWS & Azure CLIs" && \ curl -sSL https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk -O && \ apk add --update -q --force-overwrite glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk && \ rm /etc/apk/keys/sgerrand.rsa.pub glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk && \ - curl ${AWSCLI_URL} -o "awscliv2.zip" && \ - ls -sh awscliv2.zip && \ + curl https://awscli.amazonaws.com/awscli-exe-${AWSCLI_ARCH}.zip -o awscliv2.zip && \ unzip awscliv2.zip && \ ./aws/install && \ rm -f awscliv2.zip && rm -rf aws && \ - echo "Done installing AWS & Azure CLIs" && \ - echo "Install Taskfile" && \ + echo "Done installing AWS & Azure CLIs" + +FROM python:3.11-alpine@sha256:4e8e9a59bf1b3ca8e030244bc5f801f23e41e37971907371da21191312087a07 AS aws-builder +ARG AWSCLI_VERSION=2.11.18 +RUN apk add --no-cache curl make cmake gcc g++ libc-dev libffi-dev openssl-dev && \ + pip3 install --no-cache --upgrade pip setuptools wheel +RUN curl https://awscli.amazonaws.com/awscli-$AWSCLI_VERSION.tar.gz | tar -xz && \ + cd awscli-$AWSCLI_VERSION && \ + ./configure --bindir=/usr/local/bin --prefix=/aws-cli/ --with-download-deps --with-install-type=portable-exe && \ + make && \ + make install +# reduce image size +RUN rm -rf awscli-$AWSCLI_VERSION + +FROM base as base-arm64 +ARG TRIVY_ARCH="Linux-ARM64" +ADD requirements.txt . +RUN echo "Install AWS & Azure CLIs" && \ + apk add -q --no-cache bash build-base ca-certificates curl gettext git libffi-dev linux-headers musl-dev openldap-dev openssh-client python3-dev gcc libffi-dev libressl-dev make rsync tzdata groff zip && \ + python3 -m ensurepip && \ + pip3 install --no-cache --upgrade pip setuptools wheel && \ + pip3 -q install boto3 PyYAML && \ + pip3 install -r requirements.txt && \ + apk del libc6-compat && \ + echo "Done installing AWS & Azure CLIs" +COPY --from=aws-builder aws-cli/lib/aws-cli/ /usr/local/lib/aws-cli/ +RUN ln -s /usr/local/lib/aws-cli/aws /usr/local/bin/aws + +FROM base-$TARGETARCH +RUN echo "Install Taskfile" && \ curl -sSL https://taskfile.dev/install.sh | sh -s v${TASKFILE_VERSION} && \ echo "Done Install Taskfile" && \ echo "Install Docker Compose" && \ @@ -42,8 +62,8 @@ RUN echo "Install AWS & Azure CLIs" && \ echo "Done install Docker Compose" && \ echo "Install Trivy" && \ apk add -q curl && \ - curl -sSL https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_${TRIVY_ARCH}.tar.gz -o trivy_{TRIVY_ARCH}.tar.gz && \ - tar -zxf trivy_{TRIVY_ARCH}.tar.gz -C /usr/bin/ && \ + curl -sSL https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_${TRIVY_ARCH}.tar.gz -o trivy_${TRIVY_ARCH}.tar.gz && \ + tar -zxf trivy_${TRIVY_ARCH}.tar.gz -C /usr/bin/ && \ echo "Done install Trivy" && \ echo "Adding an up to date mime-types definition file" && \ curl -sSL https://salsa.debian.org/debian/mime-support/raw/master/mime.types -o /etc/mime.types && \ diff --git a/dind/config.yml b/dind/config.yml index f15272d81..1dd4ba393 100644 --- a/dind/config.yml +++ b/dind/config.yml @@ -2,7 +2,7 @@ versions: "1": platforms: - linux/amd64 - - linux/arm64 # to fix error comment this line + - linux/arm64 build_args: GLIBC_VERSION: 2.29-r0 TRIVY_VERSION: "0.36.1"