Skip to content

Commit

Permalink
[Dind] Fix : error "aws not found for amd64" from unit test "aws --ve…
Browse files Browse the repository at this point in the history
…rsion"
  • Loading branch information
bonnai.djicko committed Jul 18, 2023
1 parent 5d0c877 commit dd56c5e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -55,6 +59,7 @@ Versions
----------
* Node: Adding jq command
* Python : adding support for python 3.11
* Dind : build arm64 docker image

2022-11-30
----------
Expand Down Expand Up @@ -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
Expand Down
48 changes: 34 additions & 14 deletions dind/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand All @@ -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" && \
Expand All @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion dind/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit dd56c5e

Please sign in to comment.