Deploy to Azure Web App for Containers
With Azure Web App for Containers, you can easily deploy and run container-based web apps on Windows and Linux. In this quickstart, we will use Azure Pipelines to build and deploy our sample application to Web App for Containers App service.
With Azure Pipelines, you can implement a CI/CD workflow to automatically generate build Artifacts and trigger deployment to specific environments.
- Azure DevOps account. Create a free Azure DevOps account if you don't have one already.
- GitHub account. Create a free GitHub account if you don't have one already.
- Azure subscription. Create a free Azure account if you don't have one already.
- Create an Azure container registry if you don't have one already.
Get the code
Build and publish a Docker image to an Azure Container Registry
To complete this section successfully, you must have an Azure Container Registry. Refer to the prerequisites section for details.
Sign in to your Azure DevOps organization and navigate to your project.
Select Pipelines, and then New Pipeline.
Select GitHub when prompted for the location of your source code, and then select your repository.
Select the Docker: build and push an image to Azure Container Registry pipeline template.
Select your Azure Subscription, and then select Continue.
Select your Container registry from the drop-down menu, and then select Validate and configure.
Review the pipeline YAML template, and then select Save and run to build and publish the Docker image to your Azure Container Registry.
To view the published docker image after your pipeline run has been completed, navigate to your container registry in Azure portal, and then select Repositories.
To deploy your image from the container registry, you must enable the admin user account. Navigate to your container registry in Azure portal, and select Access keys. Next, select the toggle button to Enable Admin user.
Create an Azure Web App for Containers
Sign into Azure at https://portal.azure.com.
In the Azure portal, choose Create a resource > Containers, and then choose Web App for Containers.
Enter a name for your new web app, and select or create a new Resource Group. Select Linux for the Operating System.
In the SKU and Size section, select Change to specify the pricing tier. Select the Dev/Test plan, and then choose the F1 Free plan. Select Apply when you are done.
Select Review and create. Review your configuration, and select Create when you are done.
Create a release pipeline
From within your project, select Pipelines then Release.
Select New pipeline to create a new release pipeline.
Select the Azure App Service deployment template
Select Tasks, then Unlink all in stage 1 to unlink all the pipeline parameters.
Select the Deploy Azure App Service task, and fill out the required fields. Select Save when you are done.
Select Create release, and then choose Stage 1 from the dropdown menu. Select Create when you are done.
Hover over Stage 1 in your pipeline, and select Deploy to queue and start the deployment.
Your pipeline logs should look similar to the screenshot below.
Navigate to your newly deployed web app to verify your deployment.