forked from facebook/duckling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
56 lines (51 loc) · 2.66 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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
- development
- feature/*
- bugfix/*
- hotfix/*
pr:
- master
- develop
pool:
vmImage: 'Ubuntu-16.04'
variables:
tagshelfRegistry: 'docker.tagshelf.io'
imageName: 'tagshelfsrl/duckling'
steps:
# Builds the docker image for all allowed branches
- script: |
docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry)
docker build -f Dockerfile -t $(imageName) .
displayName: 'docker build'
# Tags builded image with the "latest" tag if its "master" branch and push
- script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):latest"
displayName: 'docker tag master as latest'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
- script: |
docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry)
docker push $(tagshelfRegistry)/$(imageName):latest
displayName: 'docker push master as latest'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
# Tags builded image with the "development" tag if its "development" branch and push
- script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)"
displayName: 'docker tag development'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development'))
- script: |
docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry)
docker push $(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)
displayName: 'docker push development'
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'development'))
# Tags builded image with the branchName_commitHash tag if its "master" or "development" branch and push
- script: docker tag $(imageName) "$(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion)"
displayName: 'docker tag branch_version'
condition: and(succeeded(), or(eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'development')))
- script: |
docker login -u $(tagshelfRegistryUser) -p $(tagshelfRegistryPass) $(tagshelfRegistry)
docker push $(tagshelfRegistry)/$(imageName):$(build.SourceBranchName)_$(build.SourceVersion)
displayName: 'docker push buikd'
condition: and(succeeded(), or(eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.SourceBranchName'], 'development')))