Created
September 14, 2022 11:58
-
-
Save i-rocky/0c877fe4fced5800fceed5e2673f48cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ARG ALPINE_VERSION=3.16 | |
| FROM python:3.10.5-alpine3.16 as builder | |
| ARG AWS_CLI_VERSION=2.7.20 | |
| RUN apk add --no-cache git | |
| RUN apk add --no-cache unzip | |
| RUN apk add --no-cache groff | |
| RUN apk add --no-cache build-base | |
| RUN apk add --no-cache libffi-dev | |
| RUN apk add --no-cache 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 | |
| # build the final image | |
| FROM alpine:${ALPINE_VERSION} | |
| COPY --from=builder /usr/local/aws-cli/ /usr/local/aws-cli/ | |
| COPY --from=builder /aws-cli-bin/ /usr/local/bin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment