forked from Azure/azure-functions-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dotnet.Dockerfile
43 lines (33 loc) · 1.82 KB
/
dotnet.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
41
42
43
# escape=`
# Installer image
FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS installer-env
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Retrieve .NET Core SDK
RUN $dotnet_sdk_version = '3.1.408'; `
Invoke-WebRequest -OutFile dotnet.zip https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-win-x64.zip; `
$dotnet_sha512 = '0593f811a912973bb1dfe72ea75f13cf531257823533fe1a4e562baff7a94fc72d05ba655bd2d9ec6c88c0bf9bb0e14931d26ddcbb7786aa4b448ef1dbccedae'; `
if ((Get-FileHash dotnet.zip -Algorithm sha512).Hash -ne $dotnet_sha512) { `
Write-Host 'CHECKSUM VERIFICATION FAILED!'; `
exit 1; `
}; `
`
Expand-Archive dotnet.zip -DestinationPath dotnet; `
Remove-Item -Force dotnet.zip
ENV ASPNETCORE_URLS=http://+:80 `
DOTNET_RUNNING_IN_CONTAINER=true `
DOTNET_USE_POLLING_FILE_WATCHER=true `
NUGET_XMLDOC_MODE=skip `
PublishWithAspNetCoreTargetManifest=false `
HOST_VERSION=3.2.0
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
$BuildNumber = $Env:HOST_VERSION.split('.')[-1]; `
Invoke-WebRequest -OutFile host.zip https://github.com/Azure/azure-functions-host/archive/v$Env:HOST_VERSION.zip; `
Expand-Archive host.zip .; `
cd azure-functions-host-$Env:HOST_VERSION; `
/dotnet/dotnet publish /p:BuildNumber=$BuildNumber /p:CommitHash=$Env:HOST_VERSION src\WebJobs.Script.WebHost\WebJobs.Script.WebHost.csproj -c Release --output C:\runtime
# Runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1809
COPY --from=installer-env ["C:\\runtime", "C:\\runtime"]
ENV AzureWebJobsScriptRoot=C:\approot `
WEBSITE_HOSTNAME=localhost:80
CMD ["dotnet", "C:\\runtime\\Microsoft.Azure.WebJobs.Script.WebHost.dll"]