Skip to content

Commit

Permalink
[Dotnet] Fix powershell errors with arm64 (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
samruddhikhandale authored Feb 9, 2024
1 parent e783d45 commit d4441d7
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/dotnet/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,24 @@ ENV NUGET_XMLDOC_MODE=
# Temporary: Upgrade packages due to mentioned CVEs
# They are installed by the base image (mcr.microsoft.com/dotnet/sdk) which does not have the patch.
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-0057
RUN apt-get update && \
apt-get install -y wget && \
ARCHITECTURE=$(dpkg --print-architecture) && \
POWERSHELL_FILE_NAME="powershell_7.4.1-1.deb_${ARCHITECTURE}.deb" && \
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/${POWERSHELL_FILE_NAME} && \
dpkg -i ${POWERSHELL_FILE_NAME} && \
apt-get install -f && \
rm ${POWERSHELL_FILE_NAME}
RUN if [ "$(dpkg --print-architecture)" = "amd64" ]; then \
apt-get update && \
apt-get install -y wget && \
POWERSHELL_FILE_NAME="powershell_7.4.1-1.deb_amd64.deb" && \
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/${POWERSHELL_FILE_NAME} && \
dpkg -i ${POWERSHELL_FILE_NAME} && \
apt-get install -f && \
rm ${POWERSHELL_FILE_NAME} ; \
fi

RUN if [ "$(dpkg --print-architecture)" = "arm64" ]; then \
apt-get update && \
apt-get install -y curl tar && \
POWERSHELL_FILE_PATH="/opt/microsoft/powershell/7" && \
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 && \
mkdir -p ${POWERSHELL_FILE_PATH} && \
tar zxf /tmp/powershell.tar.gz -C ${POWERSHELL_FILE_PATH} && \
chmod +x ${POWERSHELL_FILE_PATH}/pwsh && \
ln -snf ${POWERSHELL_FILE_PATH}/pwsh /usr/bin/pwsh && \
rm /tmp/powershell.tar.gz ; \
fi

0 comments on commit d4441d7

Please sign in to comment.