Azure Functions Python V2: Deployment with FFPMEG installation

Viraj Vaitha 0 Reputation points
2023-06-17T18:23:55.62+00:00

Hi,

I hope you're well.

I am trying to deploy an Azure Function (Python v2 programming model) via VSCode.

Whenever I deploy my application with PyDub, my code fails to run as it requires FFPMEG installed. I decided to save inside 'bin' folder the binaries for FFPMEG and FFPROBE since this is an alterative however it says Directory FFPROBE is not found.

I don't see examples anywhere on how to deploy an Azure Functions Python Programming V2 using a Docker Image, if so I could potentially install FFPMEG and FFPROBE via the docker image.

Please can someone help me with this, or provide a template docker image.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
{count} votes

1 answer

Sort by: Most helpful
  1. navba-MSFT 27,540 Reputation points Microsoft Employee Moderator
    2023-06-20T04:19:32.5233333+00:00

    @Viraj Vaitha Apologies for the late reply. Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I understand that you are trying to deploy an Azure Functions Python Programming V2 using a Docker Image so that you can install FFPMEG and FFPROBE and leverage that in your application.

    1. You can leverage the below docker file which uses the base image from our official Azure Functions Python 4.0 image and installs FFMPEG and FFPROBE using the apt-get command. It also sets the AzureWebJobsScriptRoot environment variable and copies the contents of the current directory to /home/site/wwwroot.
    FROM mcr.microsoft.com/azure-functions/python:4-python3.10
    WORKDIR /home/site/wwwroot
    ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
        AzureFunctionsJobHost__Logging__Console__IsEnabled=true
    
    RUN apt-get update && apt-get install -y ffmpeg && apt-get install -y ffprobe
    
    COPY . /home/site/wwwroot
    
    
    1. Build the Docker image using the following command:
    docker build -t myfunctionapp .
    
    1. Push the Docker image to a container registry, such as Docker Hub or Azure Container Registry. Here is an example command to push the image to Docker Hub:
    docker push myusername/myfunctionapp
    
    1. Then follow the step by step approach mentioned here and here.

    On a side note: When creating your own containers, you are required to keep the base image of your container updated to the latest supported base image. Supported base images for Azure Functions are language-specific and are found in the Azure Functions base image repos. Hope this helps.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.