Created
November 20, 2020 19:55
-
-
Save odinuv/f7e9fe9904e4b3856f6d3e1acb10b2e0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pr: none | |
trigger: | |
batch: true | |
branches: | |
include: | |
- '*' | |
variables: | |
imageName: 'job-queue-daemon' | |
tag: $(Build.BuildId) | |
productionTag: production-$(Build.SourceVersion) | |
stages: | |
- stage: prepare | |
# A couple of stages doing a lot of stuff | |
- stage: build | |
# Push production image to ACR | |
displayName: Deploy | |
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) | |
pool: | |
name: 'Default' | |
jobs: | |
- job: | |
displayName: Build Images | |
steps: | |
- task: Docker@2 | |
displayName: Build and tag the image | |
inputs: | |
command: build | |
dockerfile: '$(Build.SourcesDirectory)/Dockerfile' | |
repository: $(imageName) | |
tags: | | |
$(productionTag) | |
latest | |
- task: Docker@2 | |
displayName: ACR login | |
inputs: | |
containerRegistry: 'Keboola ACR' | |
command: login | |
- script: | | |
docker tag $(imageName):$(productionTag) keboola.azurecr.io/$(imageName):$(productionTag) | |
docker tag $(imageName):latest keboola.azurecr.io/$(imageName):latest | |
docker images | |
displayName: Tag the image for ACR | |
- task: Docker@2 | |
displayName: Push the production image to ACR | |
inputs: | |
containerRegistry: 'Keboola ACR' | |
repository: $(imageName) | |
command: push | |
tags: | | |
$(productionTag) | |
latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment