Skip to content

Instantly share code, notes, and snippets.

@philipz
Created April 27, 2019 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipz/10bde3c5039b2903d2a36a99344d0cfa to your computer and use it in GitHub Desktop.
Save philipz/10bde3c5039b2903d2a36a99344d0cfa to your computer and use it in GitHub Desktop.
Azure Function for Knative

Create a function on Linux using a custom image

func init MyFunctionProj --docker

FROM microsoft/dotnet:2.2-sdk AS installer-env

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/azure-functions/dotnet:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot

COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
# for Knative
ENV ASPNETCORE_URLS=http://+:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment