-
Notifications
You must be signed in to change notification settings - Fork 117
/
dotnet-isolated.Dockerfile
39 lines (30 loc) · 1.61 KB
/
dotnet-isolated.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
# Build the runtime from source
ARG HOST_VERSION=4.25.2
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS runtime-image
ARG HOST_VERSION
ENV PublishWithAspNetCoreTargetManifest=false
RUN BUILD_NUMBER=$(echo ${HOST_VERSION} | cut -d'.' -f 3) && \
git clone --branch v${HOST_VERSION} https://github.com/Azure/azure-functions-host /src/azure-functions-host && \
cd /src/azure-functions-host && \
HOST_COMMIT=$(git rev-list -1 HEAD) && \
dotnet publish -v q /p:BuildNumber=$BUILD_NUMBER /p:CommitHash=$HOST_COMMIT src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj -c Release --output /azure-functions-host --runtime linux-x64 && \
mv /azure-functions-host/workers /workers && mkdir /azure-functions-host/workers && \
rm -rf /root/.local /root/.nuget /src
RUN apt-get update && \
apt-get install -y gnupg wget unzip
# Include ASP.NET Core shared framework from dotnet/aspnet image.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS aspnet6
FROM mcr.microsoft.com/dotnet/runtime:6.0
ARG HOST_VERSION
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
HOME=/home \
FUNCTIONS_WORKER_RUNTIME=dotnet-isolated \
DOTNET_USE_POLLING_FILE_WATCHER=true \
HOST_VERSION=${HOST_VERSION} \
ASPNETCORE_CONTENTROOT=/azure-functions-host
# Fix from https://github.com/GoogleCloudPlatform/google-cloud-dotnet-powerpack/issues/22#issuecomment-729895157
RUN apt-get update && \
apt-get install -y libc-dev
COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ]
COPY --from=aspnet6 [ "/usr/share/dotnet", "/usr/share/dotnet" ]
CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ]