ARG REPO=mcr.microsoft.com/dotnet/aspnet # Installer image FROM $REPO:9.0.19-azurelinux3.0-amd64 AS installer RUN tdnf install -y \ tar \ && tdnf clean all # Install .NET SDK RUN dotnet_sdk_version=9.0.317 \ && dotnet_version=9.0.19 \ && curl --fail --show-error --location \ --remote-name https://builds.dotnet.microsoft.com/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \ --remote-name https://builds.dotnet.microsoft.com/dotnet/checksums/$dotnet_version-sha.txt \ && sed -i 's/\r$//' $dotnet_version-sha.txt \ && sha512sum -c $dotnet_version-sha.txt --ignore-missing \ && mkdir --parents /dotnet \ && tar --gzip --extract --no-same-owner --file dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz --directory /dotnet ./packs ./sdk ./sdk-manifests ./templates ./LICENSE.txt ./ThirdPartyNotices.txt \ && rm \ dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \ $dotnet_version-sha.txt # .NET SDK image FROM $REPO:9.0.19-azurelinux3.0-amd64 ENV \ # Do not generate certificate DOTNET_GENERATE_ASPNET_CERTIFICATE=false \ # Do not show first run text DOTNET_NOLOGO=true \ # SDK version DOTNET_SDK_VERSION=9.0.317 \ # Enable correct mode for dotnet watch (only mode supported in a container) DOTNET_USE_POLLING_FILE_WATCHER=true \ # Skip extraction of XML docs - generally not useful within an image/container - helps performance NUGET_XMLDOC_MODE=skip \ # PowerShell telemetry for docker image usage POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-Azure-Linux-3.0 RUN tdnf install -y \ git \ libgcc-atomic \ tar \ && tdnf clean all COPY --from=installer ["/dotnet", "/usr/share/dotnet"] # Trigger first run experience by running arbitrary cmd RUN dotnet help # Install PowerShell global tool RUN powershell_version=7.5.9 \ && curl --fail --show-error --location --output PowerShell.Linux.x64.$powershell_version.nupkg https://powershellinfraartifacts-gkhedzdeaghdezhr.z01.azurefd.net/tool/$powershell_version/PowerShell.Linux.x64.$powershell_version.nupkg \ && powershell_sha512='35f38a7fe5d6423e232fa7a74defea7ff778da856c15246fe8ee8141649b709957a132f34d916e85c8d1334487929a2922be67b2b8541f4dc003b4dfa4244834' \ && echo "$powershell_sha512 PowerShell.Linux.x64.$powershell_version.nupkg" | sha512sum -c - \ && mkdir --parents /usr/share/powershell \ && dotnet tool install --add-source / --tool-path /usr/share/powershell --version $powershell_version PowerShell.Linux.x64 \ && dotnet nuget locals all --clear \ && rm PowerShell.Linux.x64.$powershell_version.nupkg \ && ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \ && chmod 755 /usr/share/powershell/pwsh \ && chmod 755 /usr/share/powershell/.store/powershell.linux.x64/$powershell_version/powershell.linux.x64/$powershell_version/tools/*/any/pwsh \ # To reduce image size, remove the copy nupkg that nuget keeps. && find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm