We will learn how to build Docker image and upload Docker images into Azure Container Registry(ACR) using Azure Build pipelines.
Pre-requisites:
1. ACR is setup in Azure cloud. (see below for the steps)
2. Already created Azure DevOps dashboard in
3. Dockerfile created along with the application source code
How to Create Azure Container Registry?
First Create Resource Group Make sure you are login to Azure portal first.
az login
Execute below command to create a resource group in Azure portal.
az group create --name myResourceGroup --location southcentralus
Run the below command to create your own private container registry using Azure Container Registry (ACR).
az acr create --resource-group myResourceGroup --name myacrrepo31 --sku Standard --location southcentralus
You can login to Azure portal to see the ACR repo.
How to create a Azure Build Pipeline
1. Login into your Azure DevOps dashboard
2. Click on Pipelines.
3. Click on New Pipeline
4. Click on use the classic editor
Enter your repo name and branch name where you have stored your source code along with Dockerfile
Click on Continue. Now choose the template by typing Docker, Select Docker container and Apply.
Now pipeline is created with two tasks already. We need to configure it.
Let's modify Build an image task.
Select Push an image task
Add a task for Copying YAML file, enter the Kubernetes deployment YAML file
Add Publish artifact task
Now click Save + Queue and run to start Building the pipeline
Once the build is completed, you should be able to see the Docker images under
Services --> Repositories
Please watch the above steps in YouTube Channel:
VIDEO