Setting up environment for a panel app in an Azure Web App

I’m trying to deploy panel apps on an Azure Web App service. I’m new to Azure. (I’ve previously deployed panel apps on Heroku using Docker). Initially while I explore and figure things out, I’d like to try to set things up in Azure “manually”. The panel server deployment docs page has a very nice entry for Azure, but one thing it doesn’t mention is how to specify the Python environment or pass a requirements file. I tried installing miniconda and creating a conda environment using the online SSH console, but ran into permission glitches with the installation of some library (*.so) files when creating the environment. Here’s a sample error: [Errno 1] Operation not permitted: ‘/home/site/miniconda/pkgs/yaml-0.2.5-h7b6447c_0/lib/’. This seems weird.

My plan was to then precede the python -m panel serve ... Startup statement with a conda activate statement, like this: conda activate myenv; python -m panel serve ....

I see that virtualenv is already available, so I might try that instead of conda. But after some Googling I’m also getting the impression that Azure app services (including web apps) are not friendly to this sort of thing, and a Docker container route may be the only realistic option.

Any help would be greatly appreciated! Thanks.

1 Like

You are quite right. The way to do it with Azure Webapps is to package the python environment as a docker container and then have a process that listens to port 80 (or 8080)

To make it dead simple, I created this project. It contains an Azure pipeline to create the docker container and deploy to Azure Container Repository

You can try it with this example project

The two requirements for the github repo being deployed is an environment.yml file that can build the environment and a that does setup and start the server (in this case panel serve command). You can find an example of both in the demo repo above

Hope this helps.


Thank you @dwr-psandhu! What you’ve shared will be really helpful.

It’s disappointing this is the only way to do it, though.

1 Like