Since I am building the image and pushing to the Azure container registry(so far it's ok.) the problem for me starting after this.
Let's say I build several images with the build tag. such as api-image:23, api-image:24, api-image:25 and so on.
Question comes here: I'm running with the tag 25(also latest) in production server then I want to rollback to api-image:23(Using azure release pipeline history). My docker-compose file also has this image: api-image value. It's going to get 'latest' image. How can I get those image tags as dynamically in my compose file? As you know, Azure Devops release pipelines has a release history. Let's say I want to rollback to ex-release. How my docker-compose file knows which version I want to rollback to? If I leave the tag empty its going to get a latest tag. But my ex-release builded with api-image:23.
Also, this image already in my azure registry so I don't need to rebuild the whole project again right? I should be using it without rebuilding the app?
ps. my hosts are debian 11 on-premise.
version: '3.3'
services:
reverse-proxy:
image: xx.azurecr.io/nginx
container_name: mars_proxy
build:
context: .
dockerfile: reverse-proxy/Dockerfile
ports:
- 80:80
restart: always
slider:
image: xx.azurecr.io/mars-slider
container_name: slider
build:
context: .
dockerfile: Mars.Slider/Presentation/Dockerfile
ports:
- "8081:5100"
restart: always
My Azure-pipelines.yml
trigger:
- develop
steps:
- task: DockerCompose@0
displayName: "Container registry login"
inputs:
containerregistrytype: "Azure Container Registry"
#azureSubscription = Azure resource manager service connection name
azureSubscription: "subname"
azureContainerRegistry: '{"loginServer":"xx.azurecr.io", "id" : ""}'
dockerComposeFile: '**/docker-compose.yml'
additionalImageTags: $(Build.BuildId)
action: 'Build services'
- task: DockerCompose@0
inputs:
containerregistrytype: "Azure Container Registry"
azureSubscription: "subname"
azureContainerRegistry: '{"loginServer":"xx.azurecr.io", "id" : ""}'
dockerComposeFile: '**/docker-compose.yml'
additionalImageTags: $(Build.BuildId)
action: 'Push services'
thanks.
CodePudding user response:
Select One, and Hit >> Deploy