ARG REPO=mcr.microsoft.com/dotnet/aspnet # Installer image FROM $REPO:11.0.0-preview.7-azurelinux4.0-amd64 AS installer RUN dnf install -y \ gzip \ tar \ && dnf clean all # Install .NET SDK RUN dotnet_sdk_version=11.0.100-preview.7.26381.103 \ && curl --fail --show-error --location \ --remote-name https://ci.dot.net/public/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \ --remote-name https://ci.dot.net/public-checksums/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz.sha512 \ && echo "$(cat dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz.sha512) dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz" | sha512sum -c - \ && mkdir --parents /dotnet \ && tar --gzip --extract --no-same-owner --file dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz --directory /dotnet ./dnx ./packs ./sdk ./sdk-manifests ./templates ./LICENSE.txt ./ThirdPartyNotices.txt \ && rm \ dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \ dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz.sha512 # .NET SDK image FROM $REPO:11.0.0-preview.7-azurelinux4.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=11.0.100-preview.7.26381.103 \ # 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-4.0 RUN dnf install -y \ git \ libatomic \ tar \ && dnf clean all COPY --from=installer ["/dotnet", "/usr/share/dotnet"] RUN ln -s /usr/share/dotnet/dnx /usr/bin/dnx \ # Trigger first run experience by running arbitrary cmd && dotnet help # Install PowerShell global tool RUN powershell_version=7.7.0-preview.2 \ && 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='0bfdb2cb425e9dc45ce824746b9c686e0cfebe76e02918c3e09663cfb6d7c8a1fb9a8f983b61a30627ab5c48001e5e778ce30e977ce246bf6f48ac09f550bd6f' \ && 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