-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (40 loc) · 1.85 KB
/
Dockerfile
File metadata and controls
47 lines (40 loc) · 1.85 KB
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
41
42
43
44
45
46
47
# escape=`
ARG REPO=mcr.microsoft.com/dotnet/runtime
# Installer image
FROM mcr.microsoft.com/windows/servercore:ltsc2019-amd64 AS installer
# Install ASP.NET Core Runtime
RUN powershell -Command `
$ErrorActionPreference = 'Stop'; `
$ProgressPreference = 'SilentlyContinue'; `
`
$aspnetcore_version = '9.0.14'; `
$aspnetcore_file = 'aspnetcore-runtime-' + $aspnetcore_version + '-win-x64.zip'; `
$dotnet_checksums_file = $aspnetcore_version + '-sha.txt'; `
`
Invoke-WebRequest -OutFile $aspnetcore_file https://builds.dotnet.microsoft.com/dotnet/aspnetcore/Runtime/$aspnetcore_version/$aspnetcore_file; `
Invoke-WebRequest -OutFile $dotnet_checksums_file https://builds.dotnet.microsoft.com/dotnet/checksums/$dotnet_checksums_file; `
`
$dotnet_sha512 = ( `
(Get-Content $dotnet_checksums_file ^| Where-Object { `
$_ -match ([regex]::Escape($aspnetcore_file))` + '$'; `
}) -split '\s+' `
)[0].ToUpper(); `
$actual_hash = (Get-FileHash $aspnetcore_file -Algorithm SHA512).Hash.ToUpper(); `
`
if ($dotnet_sha512 -ne $actual_hash) { `
Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
Write-Host 'Expected: ' + $dotnet_sha512; `
Write-Host 'Actual: ' + $actual_hash; `
exit 1; `
}; `
`
mkdir dotnet; `
tar --gzip --extract --no-same-owner --file $aspnetcore_file --directory dotnet ./shared/Microsoft.AspNetCore.App; `
Remove-Item -Force `
$aspnetcore_file, `
$dotnet_checksums_file
# ASP.NET Core image
FROM $REPO:9.0.14-windowsservercore-ltsc2019
# ASP.NET Core version
ENV ASPNET_VERSION=9.0.14
COPY --from=installer ["/dotnet/shared/Microsoft.AspNetCore.App", "/Program Files/dotnet/shared/Microsoft.AspNetCore.App"]