Skip to content

Commit 51a32cf

Browse files
committed
fixes to multiarch filename to make it more robust
1 parent e0f17b8 commit 51a32cf

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

utility-pod/Dockerfile

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,18 @@ RUN mkdir /test2 && \
4848
chgrp 0 /test2 && \
4949
chmod g=u /test2
5050

51-
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
52-
curl -sfL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip ; \
51+
RUN set -eux; \
52+
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
53+
AWS_ARCH=x86_64; \
5354
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
54-
curl -sfL https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip -o awscliv2.zip ; \
55-
fi && \
56-
unzip awscliv2.zip -d awscliv2 && ./awscliv2/aws/install && rm awscliv2.zip
55+
AWS_ARCH=aarch64; \
56+
else \
57+
echo "Unsupported platform: $TARGETPLATFORM"; exit 1; \
58+
fi; \
59+
curl -sfL https://awscli.amazonaws.com/awscli-exe-linux-${AWS_ARCH}.zip -o awscliv2.zip; \
60+
unzip awscliv2.zip; \
61+
./aws/install; \
62+
rm -rf awscliv2.zip aws
5763

5864
RUN curl https://rclone.org/install.sh | bash
5965
# manually run 'rclone config' to setup the environment for each remote.
@@ -62,12 +68,18 @@ RUN curl https://rclone.org/install.sh | bash
6268
RUN curl -sfL https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz | tar -zxvf - -C /usr/local/bin/
6369

6470
# install Github CLI tool gh
65-
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
66-
curl -sfL https://github.com/cli/cli/releases/download/v2.60.0/gh_2.60.0_linux_amd64.tar.gz | tar -zxvf - gh_2.60.0_linux_amd64/bin/gh --strip-components=1 \
71+
RUN set -eux; \
72+
if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
73+
GH_ARCH=amd64; \
6774
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
68-
curl -sfL https://github.com/cli/cli/releases/download/v2.60.0/gh_2.60.0_linux_arm64.tar.gz | tar -zxvf - gh_2.60.0_linux_arm64/bin/gh --strip-components=1 \
69-
fi
70-
75+
GH_ARCH=arm64; \
76+
else \
77+
echo "Unsupported platform: $TARGETPLATFORM"; exit 1; \
78+
fi; \
79+
curl -sfL https://github.com/cli/cli/releases/download/v2.60.0/gh_2.60.0_linux_${GH_ARCH}.tar.gz -o gh.tar.gz; \
80+
tar -xzf gh.tar.gz; \
81+
cp gh_2.60.0_linux_${GH_ARCH}/bin/gh /usr/local/bin/gh; \
82+
rm -rf gh.tar.gz gh_2.60.0_linux_${GH_ARCH}
7183

7284
# Set the default shell on openshift to use bash rather than sh
7385
RUN /bin/sed -i 's/SHELL=\/bin\/sh/SHELL=\/bin\/bash/g' /etc/default/useradd

0 commit comments

Comments
 (0)