0

Maybe somebody can help me to solve this issue as I am a bit confused and honestly burning out on this little project.

I have 2 web apps, one is my production environemnet and the other web app is a staging, I have a pipeline that build a docker image and push it to the staging for testing, and when I am happy with the output I do a swap to send everything to prod.

Now everything here works fine, but I realise that the docker built version don't match between staging and prod. (staging is one version behind all the time).

So I was looking into azure python sdk to see if I can script the deployment of a specific docker version that I have in my azure acr without any success.

I can list the docker images that I have from the azure-cli, but I cannot find a python sdk library to automate this deployment.

the only bit of code I found it was the following:

from azure.containerregistry import ContainerRegistryClient
from azure.identity import DefaultAzureCredential

account_url = "URL"
client = ContainerRegistryClient(account_url, DefaultAzureCredential())

but nothing related to deployment of specific docker images to a web app. If anyone can help me to find a python library to achieve this, I would be gratefully.

Thank you so much

1 Answer 1

1

The Azure Container Registry library does not currently contain functionality for deploying specific docker images to a web app. However there is some documentation for using the Azure CLI to Build and run container image using ACR tasks or using the docker cli to push/pull to/from ACR.

Can you also provide more information about your deployment (this can help me get the right information to you)? Are you deploying to an Azure VM, kubernetes, or something else?

FYI I am a dev on the Azure SDK team and contributed to the ACR Python library.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you so much for your reply. Really appreciate it. I have 1 web app (production) and I have a swap slot. When I run my release pipeline, I deploy to the slot first, test my code(let's call this deployment v1.1), my production webapp still runs the version 1.0..so far everything is good. But when I do the swap, azure swaps the 2 webapp versions, so the staging webapp will have the version 1.0 while the production Web app will have the 1.1. So I was looking for a sdk to push the latest version of docker image to the staging after the swap. For now the ugly solution I could apply is
To run an extra task to deploy again to staging without the swap. The release to the Web app looks like this. Deploy to staging => swap slot => deploy to staging. Doing this I will have matching version for both production webapp and slot webapp
The azure-containerregistry library does not currently support this. An option for you is to use the docker cli to push/pull images from your ACR instance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.