Skip to content

Instantly share code, notes, and snippets.

@brettsam
Created July 26, 2021 22:41
Show Gist options
  • Save brettsam/67d5290fb9c49a69803b76e9ae5574e2 to your computer and use it in GitHub Desktop.
Save brettsam/67d5290fb9c49a69803b76e9ae5574e2 to your computer and use it in GitHub Desktop.
Grpc Repro
ARG HOST_VERSION=3.2.0
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS installer-env
ARG HOST_VERSION
COPY --from=mcr.microsoft.com/dotnet/core/sdk:3.1 /usr/share/dotnet /usr/share/dotnet
COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
mkdir -p /home/site/wwwroot && \
dotnet publish *.csproj --output /home/site/wwwroot
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS runtime-image
RUN BUILD_NUMBER=90001 && \
git clone --branch brettsam/update-grpc 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
FROM mcr.microsoft.com/dotnet/runtime:5.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}
COPY --from=runtime-image [ "/azure-functions-host", "/azure-functions-host" ]
CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ]
ENV AzureFunctionsJobHost__Logging__Console__IsEnabled=true \
AzureWebJobsFeatureFlags=EnableAspNetCoreGrpc
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment