Deploy of 2 Docker images on Azure App Service

Franz 21 Reputation points
2023-08-10T14:44:00.92+00:00

Hello, I have this problem with app service.

I have a container registry with 2 repositories. One contains the Docker image of an API, and the other contains the Docker image of the frontend.

I have also an app service with a basic plan. I would like to deploy both images to this app service without using slots (which would require a plan upgrade that we do not want to do).

I've tried using Deployment Center, but I can only deploy one image at a time. I've also tried using a script in the pipeline on devops, with deployment after each build, but the last of the two projects to build overrides the other one on the app service.

How can I solve this?

Thank you very much,

Francesco

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,146 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Hugo Barona 401 Reputation points MVP
    2023-08-11T17:39:08.4266667+00:00

    Hi Franz,

    the best way for you to do this would be to create 2 instances of app service, using the same plan, and run a container in each instance using the respective image.

    Note: Running 2 instances in the same plan will share the resources allocated to the plan between the instances, so you may face some issues with CPU or memory running high, and in this case you just need to scale up the plan to allocate more resources.

    You have a nice tutorial explaining how you can do it - https://learn.microsoft.com/en-us/azure/app-service/tutorial-multi-container-app


    (If the reply was helpful, please don't forget to upvote and/or accept it as the answer, thank you)

    Regards
    Hugo Barona

    0 comments No comments

  2. ajkuma 27,871 Reputation points Microsoft Employee
    2023-08-16T19:06:37.6566667+00:00

    @Franz , Following-up from the comments.

    Adding to Hugo, if your requirement fits, you may take a look at another approach with multi-container.

    Tutorial: Create a multi-container (preview) app in Web App for Containers. [Multi-container is currently in preview]

     

    To deploy both the frontend and API Docker images to your Azure App Service without using slots, you can use Docker Compose. Docker Compose is a tool for defining and running multi-container Docker applications. You can use a single Docker Compose file to define both the frontend and API services, and then deploy them together to your Azure App Service.

    The Docker Compose file defines two services, frontend and api. Each service specifies the Docker image to use and the ports to expose.

    To deploy both services to your Azure App Service, you can use the az webapp create command with the --multicontainer-config-file option to specify the Docker Compose file:

    az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name myAppService --multicontainer-config-file docker-compose.yml
    
    

    This command creates a new Azure App Service with the specified resource group, app service plan, and name. The --multicontainer-config-file option specifies the Docker Compose file to use for the deployment.

     _
    *Reference: *_

    Configure a custom container for Azure App Service

    Multi-container Linux Web App | Primary Use Case

    Kindly let us know if you have any further questions.


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.