We will learn how to build Docker image for a springboot app and upload the Docker image into Azure Container Registry(ACR) using Azure YAML pipelines.
We will learn how to automate Docker builds using Jenkins. We will use
Python based application. I have already created a repo with source code
+ Dockerfile. We will see how to create Docker image and upload into Azure Container Registry (ACR) successfully.
Pre-requisites:
1. Jenkins is up and running
2. Docker installed on Jenkins instance. Click here to for integrating Docker and Jenkins
3. Docker and Docker pipelines plug-in are installed
4. Create credentials entry for Jenkins for connecting to ACR
5. Repo created in ACR, Click here to know how to do that.
6. port 8096 is opened up in firewall rules.
Step # 1 - Create a pipeline in Jenkins
Name as myACRDockerPipelineJob
Step # 2 - Copy the pipeline code from below
Make sure you change red highlighted values below:
Your a should be updated and repo should be updated. pipeline { agent any
environment { //once you create ACR in Azure cloud, use that here registryName = "myakacrregistry/my-python-app" //- update your credentials ID after creating credentials for connecting to ACR registryCredential = 'ACR' dockerImage = '' registryUrl = 'myakacrregistry.azurecr.io' }