Skip to content

Commit a5ca074

Browse files
support amd64 and arm64
1 parent fa75d61 commit a5ca074

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

Dockerfile

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
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 \
418
&& 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 \
620
&& 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.
1221
&& ./aws/install --bin-dir /aws-cli-bin/
1322

14-
FROM public.ecr.aws/amazonlinux/amazonlinux:2
23+
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
24+
1525
RUN yum update -y \
1626
&& yum install -y less groff jq \
1727
&& yum clean all
28+
1829
COPY --from=installer /usr/local/aws-cli/ /usr/local/aws-cli/
1930
COPY --from=installer /aws-cli-bin/ /usr/local/bin/
31+
2032
WORKDIR /aws
2133
ENTRYPOINT ["/usr/local/bin/aws"]

0 commit comments

Comments
 (0)