From affcf3da7c9a20eb5312b254a45f683e2cd34bb6 Mon Sep 17 00:00:00 2001 From: Michael Schilonka Date: Mon, 17 Oct 2022 15:39:18 +0200 Subject: [PATCH] feat: install modern aws cli to Tooler (#92) --- tooler/Dockerfile | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/tooler/Dockerfile b/tooler/Dockerfile index c270020..9485fff 100644 --- a/tooler/Dockerfile +++ b/tooler/Dockerfile @@ -1,5 +1,25 @@ FROM mozilla/sops:v3-alpine AS sops +# from https://stackoverflow.com/questions/60298619/awscli-version-2-on-alpine-linux +FROM python:3.10.5-alpine as aws_builder + +ARG AWS_CLI_VERSION=2.7.20 +RUN apk add --no-cache git unzip groff build-base libffi-dev cmake +RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git + +WORKDIR aws-cli +RUN sed -i'' 's/PyInstaller.*/PyInstaller==5.2/g' requirements-build.txt +RUN python -m venv venv +RUN . venv/bin/activate +RUN scripts/installers/make-exe +RUN unzip -q dist/awscli-exe.zip +RUN aws/install --bin-dir /aws-cli-bin +RUN /aws-cli-bin/aws --version + +# reduce image size: remove autocomplete and examples +RUN rm -rf /usr/local/aws-cli/v2/current/dist/aws_completer /usr/local/aws-cli/v2/current/dist/awscli/data/ac.index /usr/local/aws-cli/v2/current/dist/awscli/examples +RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete + FROM alpine LABEL maintainer="Schille" @@ -13,7 +33,7 @@ ARG KUBESEAL_VERSION=v0.15.0 # ENV BASE_URL="https://storage.googleapis.com/kubernetes-helm" ENV BASE_URL="https://get.helm.sh" ENV TAR_FILE="helm-v${HELM_VERSION}-linux-${TARGETARCH}.tar.gz" -RUN apk add --update --no-cache curl ca-certificates tar bash git gnupg aws-cli && \ +RUN apk add --update --no-cache curl ca-certificates tar bash git gnupg && \ curl -sL ${BASE_URL}/${TAR_FILE} | tar -xvz && \ mv linux-${TARGETARCH}/helm /usr/bin/helm && \ chmod +x /usr/bin/helm && \ @@ -21,6 +41,8 @@ RUN apk add --update --no-cache curl ca-certificates tar bash git gnupg aws-cli ENV HELM_DATA_HOME=/usr/local/share/helm +COPY --from=aws_builder /usr/local/aws-cli/ /usr/local/aws-cli/ +COPY --from=aws_builder /aws-cli-bin/ /usr/local/bin/ COPY --from=sops /usr/local/bin/sops /bin/sops