I have found a solution for this issue, I am updating it here, please do review with your support team, is this standard practice to use these tasks in the azure pipeline. If it is standard practice, the community can use this method for the multiarchitecture IoT Edge image builds.
The solution which I found is depends on Buildx commands, we need to install it on the Pipeline Agent and run the series of buildx commands. The Filepath should contain the Dockerfile in the repository.
Thank you.
D. Vishnu
#Install BuildX Plug-in using commands
- task: Bash@3
displayName: 'Install BuildX Plug-in.'
inputs:
targetType: 'inline'
script: |
echo "=====> Installation of plugin"
sudo apt update && sudo apt install -y docker-buildx-plugin
sudo docker buildx version
sudo apt list --upgradable
#Execution Mult-Arch commands for targeted platforms
- task: PowerShell@2
displayName: 'Execution of Buildx commands'
inputs:
targetType: 'inline'
script: |
Write-Host "Execution of Buildx Commands"
Set-Location -Path $(System.DefaultWorkingDirectory)/$(FilePath)
$current_directory = pwd
Write-Host $current_directory
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --name multiarchbuilder
docker buildx use multiarchbuilder
docker buildx ls
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64,linux/arm64 -t imagerepoaddr:tags--push .
Write-Host "Ended execution of Buildx Commands."