Today we will go through an example scenario where the customer wants to modernize their ASP .NET Core Employee management application and they are having below requirement
- Plan to efficient and effective cloud migration strategy.
- No plan to re-architect legacy applications.
- They want to have control over the runtime, framework, tooling, and packages of the web-based application.
- Take full advantage of cloud benefits, such as scalability and high availability.
- Supports modern development and faster app start-up.
- Container orchestration is not needed
- Automated build and deployment.
- Containerize application architecture.
- Use WebApp as container (Paas service).
- Use Azure container registry for Private Image repository for Docker image management.
- CI/CD deployment process.
Based on the requirements the following azure components are recommended:
- Azure Subscription (Active state)
- App service Plan – Standard Tier
- Web App for Docker Container (Linux)
- ACR (Image Repository)
- Azure pipeline (To build Image)
Please find below the architecture flow
- Developer modifies the existing code using Visual studio IDE
- Developer pushes the code to Azure Repo.
- Azure build pipeline is triggered based on Repo changes and will copy required files.
- Azure pipelines invokes Docker build step which reads the instruction on Docker file and creates a Docker image.
- Azure pipelines invokes Docker push step which pushes the image to Azure container Registry.
- Once a new image is pushed into azure container registry, web hooks gets triggered (Continuous deployment) .Web hook passes required information to Web app that new image is available.
- The latest images gets deployed from ACR into azure web app
Docker file contains collections of commands and instructions that will be automatically executed in sequence in the docker environment for building a new docker image.
Please find the Docker file details below
Docker file location
Azure Repos is a set of version control tools that you can use to manage your code.
Application code and Docker file changes are stored in Azure Repo
Azure Container Registry allows you to build, store, and manage container images and artifacts in a private registry for all types of container deployments
Creating – Container Registry
Container Registry –Overview Page
Azure Pipelines is a cloud service that you can use to automatically build and test our code project and make it available to other users.
We are using Azure build pipeline to create an image and push it to the Azure container registry.
Please find build Pipeline Docker setting and Container repository setting below
Azure App Service enables you to build and host web apps and RESTful APIs in the programming language of our choice without managing infrastructure.
Application app service Main page
We will be using Continuous deployment for deploying custom container images on Azure web app from managed Azure Container Registry repositories
Enable continuous deployment with ACR
Once Continuous Deployment has been enabled, we can view the newly created webhook on your Azure Container Registry webhooks page
- When user commit’s the changes , the code will be pushed to repository
- Azure build pipeline triggered automatically based on the repo changes
- Azure pipeline Build step will complete the required Docker image creation
- Azure pipeline -Push step will push the image to Azure container registry
- An image entry is available in Azure container registry as shown below
6. Web hook (Continuous deployment) will be deploying the latest Image to the Azure web app
And you are ready to hit you .azurewebsites.net url .