Azure Function are not loaded at runtime after deployment using container and python image

Minh Pham | Ximius 5 Reputation points
2024-05-24T12:00:57.9766667+00:00

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



Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,571 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Minh Pham | Ximius 5 Reputation points
    2024-05-26T18:17:48.06+00:00

    I got it figure out, I was missing out on AzureWebJobStorage variable

    0 comments No comments