-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathDockerfile
40 lines (33 loc) · 1.41 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# escape=`
# Installer image
FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64 AS installer
# Retrieve .NET Runtime
RUN powershell -Command `
$ErrorActionPreference = 'Stop'; `
$ProgressPreference = 'SilentlyContinue'; `
`
$dotnet_version = '9.0.1'; `
Invoke-WebRequest -OutFile dotnet.zip https://builds.dotnet.microsoft.com/dotnet/Runtime/$dotnet_version/dotnet-runtime-$dotnet_version-win-x64.zip; `
$dotnet_sha512 = '30b880c3cd6c39355e92b5422e8c044a26fba1da15b4f1f8a89dc4622962c8a3537b075064c33c8493d8bbc909ae8c135a5533110080e95ef31e3407eade291f'; `
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $dotnet_sha512) { `
Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
exit 1; `
}; `
`
mkdir dotnet; `
tar -oxzf dotnet.zip -C dotnet; `
Remove-Item -Force dotnet.zip
# Runtime image
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022-amd64
ENV `
# Configure web servers to bind to port 8080 when present
ASPNETCORE_HTTP_PORTS=8080 `
# Enable detection of running in a container
DOTNET_RUNNING_IN_CONTAINER=true `
# .NET Runtime version
DOTNET_VERSION=9.0.1
# In order to set system PATH, ContainerAdministrator must be used
USER ContainerAdministrator
RUN setx /M PATH "%PATH%;C:\Program Files\dotnet"
USER ContainerUser
COPY --from=installer ["/dotnet", "/Program Files/dotnet"]