Skip to content

Commit

Permalink
Reduce image size (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdeme authored Jun 18, 2023
1 parent ccfb118 commit c5257cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ github.repository }}:${{ github.sha }}
AWS_CLI_VERSION: 2.11.26
AWS_CLI_VERSION: 2.12.1
ALPINE_VERSION: 3.18
steps:
- name: Check out repository code
Expand Down
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG ALPINE_VERSION

FROM python:3.11-alpine${ALPINE_VERSION}
FROM python:3.11-alpine${ALPINE_VERSION} AS builder

ARG AWS_CLI_VERSION

Expand All @@ -19,8 +19,7 @@ RUN mkdir /aws && \
./scripts/installers/make-exe

RUN unzip /aws/dist/awscli-exe.zip && \
./aws/install --bin-dir /aws-cli-bin && \
/aws-cli-bin/aws --version
./aws/install --bin-dir /aws-cli-bin

# Reduce image size: remove autocomplete and examples
RUN rm -rf \
Expand All @@ -30,4 +29,11 @@ RUN rm -rf \
find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.json -delete && \
find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete

FROM alpine:${ALPINE_VERSION}

COPY --from=builder /usr/local/aws-cli /usr/local/aws-cli
COPY --from=builder /aws-cli-bin /aws-cli-bin

RUN /aws-cli-bin/aws --version

CMD ["/bin/sh"]

0 comments on commit c5257cb

Please sign in to comment.