Skip to content

Instantly share code, notes, and snippets.

@yizhang82
Last active April 12, 2018 23:41
Show Gist options
  • Save yizhang82/77eec7b42fea059aee12753a6ae984f0 to your computer and use it in GitHub Desktop.
Save yizhang82/77eec7b42fea059aee12753a6ae984f0 to your computer and use it in GitHub Desktop.
Dotnet 2.0.6 runtime image on Windows Server Core 1709
# escape=`
# Installer image
FROM microsoft/windowsservercore:1709 AS installer-env
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Retrieve .NET Core Runtime
ENV DOTNET_VERSION 2.0.6
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-win-x64.zip
ENV DOTNET_DOWNLOAD_SHA c139ee4f8f65581d908efad230111948abb29431c26d058995386d796c71890423ef0654fbc6791ac6e1a889ba2c0bb755c58ac08232d9d009da3e7d55da60d1
RUN Invoke-WebRequest $Env:DOTNET_DOWNLOAD_URL -OutFile dotnet.zip; `
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $Env:DOTNET_DOWNLOAD_SHA) { `
Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
exit 1; `
}; `
`
Expand-Archive dotnet.zip -DestinationPath dotnet; `
Remove-Item -Force dotnet.zip
# Runtime image
FROM microsoft/windowsservercore:1709
COPY --from=installer-env ["dotnet", "C:\\Program Files\\dotnet"]
# In order to set system PATH, ContainerAdministrator must be used
USER ContainerAdministrator
RUN setx /M PATH "%PATH%;C:\Program Files\dotnet"
USER ContainerUser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment