|
1 | | -FROM public.ecr.aws/amazonlinux/amazonlinux:2 as installer |
2 | | -ARG VERSION="2.22.5" |
3 | | -RUN yum update -y \ |
| 1 | +# syntax=docker/dockerfile:1.4 |
| 2 | +FROM --platform=$BUILDPLATFORM public.ecr.aws/amazonlinux/amazonlinux:2023 as installer |
| 3 | + |
| 4 | +# Use ARG for platform-specific AWS CLI installer |
| 5 | +ARG TARGETARCH |
| 6 | +# Get latest version of AWS CLI v2 |
| 7 | +ENV AWS_CLI_VERSION="2.16.17" |
| 8 | + |
| 9 | +# Set download URL based on architecture |
| 10 | +RUN if [ "$TARGETARCH" = "amd64" ]; then \ |
| 11 | + ARCH="x86_64"; \ |
| 12 | + elif [ "$TARGETARCH" = "arm64" ]; then \ |
| 13 | + ARCH="aarch64"; \ |
| 14 | + else \ |
| 15 | + echo "Unsupported architecture: $TARGETARCH" && exit 1; \ |
| 16 | + fi \ |
| 17 | + && yum update -y \ |
4 | 18 | && yum install -y curl unzip \ |
5 | | - && curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${VERSION}.zip" -o awscliv2.zip \ |
| 19 | + && curl -sSL "https://awscli.amazonaws.com/awscli-exe-linux-${ARCH}-${AWS_CLI_VERSION}.zip" -o awscliv2.zip \ |
6 | 20 | && unzip awscliv2.zip \ |
7 | | - # The --bin-dir is specified so that we can copy the |
8 | | - # entire bin directory from the installer stage into |
9 | | - # into /usr/local/bin of the final stage without |
10 | | - # accidentally copying over any other executables that |
11 | | - # may be present in /usr/local/bin of the installer stage. |
12 | 21 | && ./aws/install --bin-dir /aws-cli-bin/ |
13 | 22 |
|
14 | | -FROM public.ecr.aws/amazonlinux/amazonlinux:2 |
| 23 | +FROM public.ecr.aws/amazonlinux/amazonlinux:2023 |
| 24 | + |
15 | 25 | RUN yum update -y \ |
16 | 26 | && yum install -y less groff jq \ |
17 | 27 | && yum clean all |
| 28 | + |
18 | 29 | COPY --from=installer /usr/local/aws-cli/ /usr/local/aws-cli/ |
19 | 30 | COPY --from=installer /aws-cli-bin/ /usr/local/bin/ |
| 31 | + |
20 | 32 | WORKDIR /aws |
21 | 33 | ENTRYPOINT ["/usr/local/bin/aws"] |
0 commit comments