'Is it possible to convert the publish method of an App Service from Code to Docker?

I have set up an Azure App Service (Linux) publish method being Code and have set up the appropriate pipeline to build and deploy my code (nodejs). Now I need more control on the host running my code (need poppler). On dev + test I have created new App Services and have chosen Docker Container as publish method

My question: for my PROD instance, is it possible to change the publish method of my existing App Service or do I have to create a new App Service ?

Assuming the latter, I would need to update the client to point to the new App Service URL. To avoid that, could I first delete the existing App Service and create a new one with the same name ? This would make me lose all stats and logs.

Any alternative suggestions?

enter image description here



Solution 1:[1]

the App Service Plan can run either code or container

https://docs.microsoft.com/en-us/cli/azure/appservice/plan?view=azure-cli-latest#az-appservice-plan-create

The Web App that target the App Service Plan can come from a custom docker OR a known source code base. (e.g. nodejs)

https://docs.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest#az-webapp-create

when selecting code, you are setting the runtimes and allowing the web app to fetch the code, what happens is the the runtime will used a well known base container and bring in your code.

In the end, you shouldn't have a problem deploying a container based web app on the same App Service Plan even though the original deployment was using Code Base.

you should rely on the Azure CLI more since the portal sometimes doesn't provide you with the full power.

Also hav a look at the App Service Swapping method, to move your traffic from your code base to your container base.

https://docs.microsoft.com/en-us/azure/app-service/deploy-staging-slots

you can leverage slots to help you out with the swapping!

Solution 2:[2]

This should do the trick:

az webapp config set -g MyResourceGroup -n MyApp \
  --linux-fx-version="DOCKER|mcr.microsoft.com/appsvc/php:8.1-fpm_20220512.1"

Where "mcr.microsoft.com/appsvc/php:8.1-fpm_20220512.1" is dsn of your image.

Using a private container registry? See the az webapp config container set command to configure the credentials.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman
Solution 2 Sil