aksworkshop/azure-pipelines.yml

39 строки
1.1 KiB
YAML

# Docker image
# Build a Docker image to deploy, run, or push to a container registry.
# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
name: $(build.sourceBranchName)-$(Date:yyyyMMdd)$(Rev:.r)
pool:
vmImage: 'Ubuntu 16.04'
variables:
imageName: '$(dockerId)/site'
trigger:
batch: true
branches:
include:
- aksworkshop-master
- aksworkshop-staging
# no PR builds
pr: none
steps:
- script: sed -i 's/#BUILD_ID#/$(build.buildNumber)/g' _includes/nav.html
displayName: 'update site with build number'
- script: sed -i 's/#COMMIT_ID#/$(build.SourceVersion)/g' _includes/nav.html
displayName: 'update site with build number'
- script: docker build -f Dockerfile -t $(imageName) .
displayName: 'docker build'
- script: docker login -u $(dockerId) -p $(dockerPassword)
displayName: 'docker login'
- script: |
docker tag $(imageName) $(imageName):$(build.buildNumber)
docker push $(imageName):$(build.buildNumber)
displayName: 'docker push with build number'