Skip to content

Commit 486e475

Browse files
[Dotnet] Fix powershell errors with arm64
1 parent e783d45 commit 486e475

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/dotnet/.devcontainer/Dockerfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,24 @@ ENV NUGET_XMLDOC_MODE=
99
# Temporary: Upgrade packages due to mentioned CVEs
1010
# They are installed by the base image (mcr.microsoft.com/dotnet/sdk) which does not have the patch.
1111
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-0057
12-
RUN apt-get update && \
13-
apt-get install -y wget && \
14-
ARCHITECTURE=$(dpkg --print-architecture) && \
15-
POWERSHELL_FILE_NAME="powershell_7.4.1-1.deb_${ARCHITECTURE}.deb" && \
16-
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/${POWERSHELL_FILE_NAME} && \
17-
dpkg -i ${POWERSHELL_FILE_NAME} && \
18-
apt-get install -f && \
19-
rm ${POWERSHELL_FILE_NAME}
12+
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
13+
apt-get update && \
14+
apt-get install -y wget && \
15+
POWERSHELL_FILE_NAME="powershell_7.4.1-1.deb_amd64.deb" && \
16+
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/${POWERSHELL_FILE_NAME} && \
17+
dpkg -i ${POWERSHELL_FILE_NAME} && \
18+
apt-get install -f && \
19+
rm ${POWERSHELL_FILE_NAME} ; \
20+
fi
21+
22+
RUN if [ "$(dpkg --print-architecture)" = "arm64" ]; then \
23+
apt-get update && \
24+
apt-get install -y curl tar && \
25+
POWERSHELL_FILE_PATH="/opt/microsoft/powershell/7" && \
26+
curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell-7.4.1-linux-arm64.tar.gz && \
27+
mkdir -p ${POWERSHELL_FILE_PATH} && \
28+
tar zxf /tmp/powershell.tar.gz -C ${POWERSHELL_FILE_PATH} && \
29+
chmod +x ${POWERSHELL_FILE_PATH}/pwsh && \
30+
ln -snf ${POWERSHELL_FILE_PATH}/pwsh /usr/bin/pwsh && \
31+
rm /tmp/powershell.tar.gz ; \
32+
fi

0 commit comments

Comments
 (0)