Since the Azure Function runtime is now ported to .NET Core (currently in Beta) you are now able to develop and RUN Azure Function cross platform. The current core tools also come with docker support, which means you are able to run Azure Function inside a Docker container. To get the latest core tools, follow the steps in the announcement.
Creating the docker container
It is very easy to create your function with docker support. When using the core tools you just need to pass
--docker to the
init action. The whole command is
func init --docker. This will create a Azure Function project with docker support in the current folder.
For your existing Azure Functions App 2.0 projects you can manualy create a dockerfile.
FROM microsoft/azure-functions-runtime:v2.0.0-beta1 ENV AzureWebJobsScriptRoot=/home/site/wwwroot COPY . /home/site/wwwroot
Now you can run
docker build -t dockerfunc . and
docker run -p 8080:80 dockerfunc which will create the container and run it.
Running the container in AWS
Since Azure Functions is now cross platform and can run in a container, can it run on Amazon EC2 Container Services? YES IT CAN #BecauseWeCan! Just setup Amazon EC2 Container Services as described here, push your image to the private EC2 repository, and run it!
You are now able to run Azure Functions where ever you want, even on AWS or on premises. You can find the full example on GitHub