This repo describes how to create and deploy Azure Function apps to a docker container.
This will create a basic function project and deploying it to a docker image. This does not cover creating the function itself.
-
Create Function:
func init <MyFunctionProj>
-
Create Docker File:
func init --docker-only
-
Optional -- If using function key, create host_secrets.json. Add the following contents to DOCKERFILE
ADD host_secret.json /azure-functions-host/Secrets/host.json ENV AzureWebJobsSecretStorageType=files
-- Add functions --
-
Create Docker Image (Only Run This On Image Updates):
docker build -f DockerFile -t <DockerImageName>:latest .
-
Deploy Docker Image to Container:
docker run -p 8080:80 <DockerImageName>
Removes a docker container (must be stopped)
docker container rm <container name or id>
Renames a docker container.
docker container rename <container name> <container name new>
Get docker id by running docker images list
docker images rm <id>