-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yml
41 lines (37 loc) · 1.61 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# 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
trigger:
- master
pool:
vmImage: 'win1803'
variables:
imageName: 'athens-win-test:$(build.buildId)'
dockerHubImageName: 'gomods/$(imageName)'
acrRegistryName: 'gomods'
acrLoginServer: '$(acrRegistryName).azurecr.io'
acrImageName: '$(acrLoginServer)/$(imageName)'
steps:
- powershell: |
choco install azure-cli
gci 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin'
echo "docker build"
docker build --isolation=hyperv -f Dockerfile -t $(imageName) .
# echo "dockerhub login"
# docker login -u $(dockerHubUsername) -p $(dockerHubPassword)
# echo "tag for dockerhub"
# docker tag $(imageName) $(dockerHubImageName)
# echo "push to dockerhub"
# docker push $(dockerHubImageName)
# echo "done with dockerhub and ACR push"
# for some reason choco install azure-cli does not add the az dir to the PATH
# dir based on https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/Product.wxs
echo "Azure CLI Login"
& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" login --service-principal -u $(acr-appId) -p $(acr-password) --tenant $(acr-tenant)
echo "ACR login"
& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" acr login --name $(acrRegistryName)
echo "tag for ACR"
docker tag $(imageName) $(acrImageName)
docker push $(acrImageName)
echo "done with ACR push"