Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,114 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have really simple app, that we pull from the our azure registry. The image is pull from the docker registry, but the problem is that it could not find the functions when deploy. It worked fine if we deploy it using VSCode and locally. Also, it could not find the function_app.py, host.json(). Instead they generate random host.json()
We have the functions as follow:
import azure.functions as func
app = func.FunctionApp()
@app.function_name(name="HttpTrigger1")
@app.route(route="req")
def main(req: func.HttpRequest) -> str:
user = req.params.get("user")
return f"Hello, {user}!"
host.json
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.*, 4.0.0)"
}
}
The image:
# Base the image on the built-in Azure Functions Python image
FROM mcr.microsoft.com/azure-functions/python:4-python3.10 as build
FROM build as develop
ENV WEBSITE_ENABLE_SYNC_UPDATE_SITE=true
ENV WEBSITES_ENABLE_APP_SERVICE_STORAGE=false
ENV PYTHONUNBUFFERED=1
# Add files from this repo to the root site folder.
COPY . /home/site/wwwroot
# Install requirements
RUN cd /home/site/wwwroot && pip install -r requirements.txt
I got it figure out, I was missing out on AzureWebJobStorage variable