Skip to content

Instantly share code, notes, and snippets.

@odinuv
Created November 20, 2020 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odinuv/f7e9fe9904e4b3856f6d3e1acb10b2e0 to your computer and use it in GitHub Desktop.
Save odinuv/f7e9fe9904e4b3856f6d3e1acb10b2e0 to your computer and use it in GitHub Desktop.
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