I have a Bitbucket repository which builds my code with a pipeline and pushes a docker image to Docker Hub. So far, so good. Now I want to continues deploy the latest image to my Container App on Azure. My options seems to be:
- Setup Continuous Deployment in Azure
- Create a pipeline step in bitbucket to push the new image created to Azure with Azure CLI
My problem with 1. is that it seems to be only support for GitHub with it required.
And my problem with 2. is that it doesnt look like Atlassian has this supported
Which leaves me with some costum created pipeline where Im suppose to do this with Azure CLI where Im way out of my depth.
Does anyone have a suggestion to how I can automaticly update my Container App?
Thanks to simon@edgeworks for helping me to a working solution:
First thing to note: login for dockerhub for private repositories uses "registry.hub.docker.com" not "docker.io". A bit hard to find.
Creating a Service Principal
First thing we need to do is create a service principal for the container. You cna do this with the Azure CLI available at the portal.
In the console, update and post the following script:
You'll find all this information on the overview page of your application. Response will give you 3 Keys you'll need to add to your bitbucket workspace
Setup Bitbucket with Service Principal
Select settings in the top right
Scroll down to the bottom of the menu to your left and find Workspace Variables.
Add AZURE_APP_ID, AZURE_PASSWORD and AZURE_TENANT_ID from the output in Azure CLI. I've also added secrets for DockerHub username and password with used in my pipeline.
In my pipe, I get the version from pacakage.json and sets it on the dockerimage.
I hope you find this informative and that it'll help you in your project.