Skip to content

Commit

Permalink
feat: install modern aws cli to Tooler (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
Schille authored Oct 17, 2022
1 parent 0861699 commit affcf3d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tooler/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -13,14 +33,16 @@ 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 && \
rm -rf linux-${TARGETARCH}

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


Expand Down

0 comments on commit affcf3d

Please sign in to comment.