Skip to content

Commit 43ec059

Browse files
committed
even more sonar fixes
1 parent 69a66d3 commit 43ec059

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM mcr.microsoft.com/devcontainers/base:ubuntu
22

3-
43
ARG TARGETARCH
54
ENV TARGETARCH=${TARGETARCH}
65

docker/Dockerfile

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
11
FROM ubuntu:24.04
22

3+
ARG TARGETARCH
4+
ENV TARGETARCH=${TARGETARCH}
5+
6+
ARG ASDF_VERSION
7+
COPY .tool-versions.asdf /tmp/.tool-versions.asdf
8+
39
ARG VERSION
410

511
RUN apt-get update \
612
&& export DEBIAN_FRONTEND=noninteractive \
7-
&& apt-get -y upgrade
8-
9-
RUN export DEBIAN_FRONTEND=noninteractive \
13+
&& apt-get -y upgrade \
1014
&& apt-get -y install --no-install-recommends ca-certificates curl git jq make unzip wget \
1115
&& apt-get clean
1216

1317
# install aws stuff
14-
ADD https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip /tmp/awscliv2.zip
15-
RUN unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
18+
# Download correct AWS CLI for arch
19+
RUN if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then \
20+
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"; \
21+
else \
22+
wget -O /tmp/awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"; \
23+
fi && \
24+
unzip /tmp/awscliv2.zip -d /tmp/aws-cli && \
1625
/tmp/aws-cli/aws/install && \
17-
rm tmp/awscliv2.zip && \
18-
rm -rf /tmp/aws-cli
26+
rm /tmp/awscliv2.zip && rm -rf /tmp/aws-cli
27+
28+
# Install ASDF
29+
RUN ASDF_VERSION=$(awk '!/^#/ && NF {print $1; exit}' /tmp/.tool-versions.asdf) && \
30+
if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
31+
wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-arm64.tar.gz; \
32+
else \
33+
wget -O /tmp/asdf.tar.gz https://github.com/asdf-vm/asdf/releases/download/v${ASDF_VERSION}/asdf-v${ASDF_VERSION}-linux-amd64.tar.gz; \
34+
fi && \
35+
tar -xvzf /tmp/asdf.tar.gz && \
36+
mv asdf /usr/bin
1937

2038
RUN useradd -ms /bin/bash cdkuser
2139
RUN chown -R cdkuser /home/cdkuser
2240
WORKDIR /home/cdkuser
2341
USER cdkuser
24-
# Install ASDF
25-
RUN git clone https://github.com/asdf-vm/asdf.git /home/cdkuser/.asdf --branch v0.14.1; \
26-
echo '. /home/cdkuser/.asdf/asdf.sh' >> ~/.bashrc; \
27-
echo '. /home/cdkuser/.asdf/completions/asdf.bash' >> ~/.bashrc; \
28-
echo 'PATH="$PATH:/home/cdkuser/.asdf/bin/"' >> ~/.bashrc;
2942

30-
ENV PATH="$PATH:/home/cdkuser/.asdf/bin/:/home/cdkuser/node_modules/.bin"
43+
ENV PATH="$PATH:/home/cdkuser/.asdf/shims/:/home/cdkuser/node_modules/.bin"
3144

3245
# Install ASDF plugins
3346
RUN asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git

docker/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo "**************************************"
99
echo
1010
echo
1111

12-
if [ -z "${CDK_APP_PATH}" ]; then
12+
if [[ -z "${CDK_APP_PATH}" ]]; then
1313
echo "CDK_APP_PATH is unset or set to the empty string"
1414
exit 1
1515
fi
@@ -23,13 +23,13 @@ cd /home/cdkuser/workspace/ || exit
2323
asdf install
2424
asdf reshim nodejs
2525

26-
if [ "${SHOW_DIFF}" = "true" ]
26+
if [[ "${SHOW_DIFF}" = "true" ]]
2727
then
2828
echo "Running diff"
2929
npx cdk diff \
3030
--app "npx ts-node --prefer-ts-exts ${CDK_APP_PATH}"
3131
fi
32-
if [ "${DEPLOY_CODE}" = "true" ]
32+
if [[ "${DEPLOY_CODE}" = "true" ]]
3333
then
3434
echo "Running deploy"
3535
npx cdk deploy \

0 commit comments

Comments
 (0)