|
| 1 | +# escape=` |
| 2 | + |
| 3 | +# Installer image |
| 4 | +FROM mcr.microsoft.com/windows/servercore:1803 AS installer-env |
| 5 | + |
| 6 | +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] |
| 7 | + |
| 8 | +# Retrieve .NET Core SDK |
| 9 | +ENV DOTNET_SDK_VERSION 2.1.104 |
| 10 | +ENV DOTNET_SDK_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-win-x64.zip |
| 11 | +ENV DOTNET_SDK_DOWNLOAD_SHA f3a46570f220cafbdb2f7d40cddd09a8f718b62f02fbea79fdf8e48ac1871a20d2e79191b037a559b7f2bd88064e1ec70d2c68988312a7ee23d34dc757b9981b |
| 12 | + |
| 13 | +RUN Invoke-WebRequest $Env:DOTNET_SDK_DOWNLOAD_URL -OutFile dotnet.zip; ` |
| 14 | + if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $Env:DOTNET_SDK_DOWNLOAD_SHA) { ` |
| 15 | + Write-Host 'CHECKSUM VERIFICATION FAILED!'; ` |
| 16 | + exit 1; ` |
| 17 | + }; ` |
| 18 | + ` |
| 19 | + Expand-Archive dotnet.zip -DestinationPath dotnet; ` |
| 20 | + Remove-Item -Force dotnet.zip |
| 21 | + |
| 22 | + |
| 23 | +# SDK image |
| 24 | +FROM mcr.microsoft.com/windows/nanoserver:1809 |
| 25 | + |
| 26 | +COPY --from=installer-env ["dotnet", "C:\\Program Files\\dotnet"] |
| 27 | + |
| 28 | +# In order to set system PATH, ContainerAdministrator must be used |
| 29 | +USER ContainerAdministrator |
| 30 | +RUN setx /M PATH "%PATH%;C:\Program Files\dotnet" |
| 31 | +USER ContainerUser |
| 32 | + |
| 33 | +# Trigger the population of the local package cache |
| 34 | +ENV NUGET_XMLDOC_MODE skip |
| 35 | +RUN mkdir warmup ` |
| 36 | + && cd warmup ` |
| 37 | + && dotnet new ` |
| 38 | + && cd .. ` |
| 39 | + && rmdir /s /q warmup |
| 40 | + |
| 41 | +# Workaround for https://github.com/Microsoft/DockerTools/issues/87. This instructs NuGet to use 4.5 behavior in which |
| 42 | +# all errors when attempting to restore a project are ignored and treated as warnings instead. This allows the VS |
| 43 | +# tooling to use -nowarn:MSB3202 to ignore issues with the .dcproj project |
| 44 | +ENV RestoreUseSkipNonexistentTargets false |
0 commit comments