ARG REPO=mcr.microsoft.com/dotnet/core/aspnet FROM $REPO:3.1-alpine3.12 ENV \ # Unset ASPNETCORE_URLS from aspnet base image ASPNETCORE_URLS= \ # Disable the invariant mode (set in base image) DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false \ # Enable correct mode for dotnet watch (only mode supported in a container) DOTNET_USE_POLLING_FILE_WATCHER=true \ LC_ALL=en_US.UTF-8 \ LANG=en_US.UTF-8 \ # 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-DotnetCoreSDK-Alpine-3.12 # Add dependencies for disabling invariant mode (set in base image) RUN apk add --no-cache icu-libs # Install .NET Core SDK RUN dotnet_sdk_version=3.1.301 \ && wget -O dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-musl-x64.tar.gz \ && dotnet_sha512='f1631569991b448ab9814fe1150609136f428d686d67f93e23b203163dc743de9b0c061bd5dd15f383c832a143ed9e2f7e70d4d417f75c6812d4ff09efb82188' \ && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ && mkdir -p /usr/share/dotnet \ && tar -C /usr/share/dotnet -oxzf dotnet.tar.gz ./packs ./sdk ./templates ./LICENSE.txt ./ThirdPartyNotices.txt \ && rm dotnet.tar.gz \ # Trigger first run experience by running arbitrary cmd && dotnet help # Install PowerShell global tool RUN powershell_version=7.0.1 \ && wget -O PowerShell.Linux.Alpine.$powershell_version.nupkg https://pwshtool.blob.core.windows.net/tool/$powershell_version/PowerShell.Linux.Alpine.$powershell_version.nupkg \ && powershell_sha512='a2390780d098e686c9e43a3ade215240ac7699904807cebcdb00804248b88f1afb8592aca29d28d3a9c9294534016a6d5c4014e7d0f2c2865518c32be02b8368' \ && echo "$powershell_sha512 PowerShell.Linux.Alpine.$powershell_version.nupkg" | sha512sum -c - \ && mkdir -p /usr/share/powershell \ && dotnet tool install --add-source / --tool-path /usr/share/powershell --version $powershell_version PowerShell.Linux.Alpine \ && dotnet nuget locals all --clear \ && rm PowerShell.Linux.Alpine.$powershell_version.nupkg \ && chmod 755 /usr/share/powershell/pwsh \ && ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \ # To reduce image size, remove the copy nupkg that nuget keeps. && find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm \ # Add ncurses-terminfo-base to resolve psreadline dependency && apk add --no-cache ncurses-terminfo-base