1/27/2019

summarise Azure function docker image deploy



*make python virtualenv
*activate python virtualenv !!
*install azure util cli
https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image#run-the-build-command

make project (app)
func init DocApp100 --docker

change directory
cd DocApp100

new function
func new --name MyHttpTrigger --template "HttpTrigger"

build docker image
docker build --tag marearts/image:v1 .

make new resource group
az group create --name DocGroup --location westeurope

storage account
az storage account create --name docstorage100 --location westeurope --resource-group DocGroup --sku Standard_LRS

create linux service plan
az appservice plan create --name docserviceplan --resource-group DocGroup --sku B1 --is-linux

create app and deploy
az functionapp create --name docapp100 --storage-account docstorage100 --resource-group DocGroup --plan docserviceplan --deployment-container-image-name marearts/image:v1

Configuration the function app
storageConnectionString=$(az storage account show-connection-string --resource-group DocGroup --name docstorage100 --query connectionString --output tsv)
az functionapp config appsettings set --name docapp100 --resource-group DocGroup --settings AzureWebJobsDashboard=$storageConnectionString AzureWebJobsStorage=$storageConnectionString

Test
curl https://docapp100.azurewebsites.net/api/MyHttpTrigger?name=myname


No comments:

Post a Comment