-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
50 lines (48 loc) · 1.42 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
trigger:
- master
- develop
- feature/*
- hotfix/*
variables:
${{ if eq( variables['Build.SourceBranchName'], 'master' ) }}:
imageName: release
serverCon: $(PROD_SERVER_ADR)
${{ else }}:
imageName: development
serverCon: $(TEST_SERVER_ADR)
stages:
- stage:
displayName: 'Deploy to test environment'
jobs:
- job:
displayName: 'Build and deploy'
steps:
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: login
containerRegistry: allbertCommonRegistryConnection
- task: Bash@3
displayName: 'Echo server address'
inputs:
targetType: 'inline'
script: echo '${{variables.serverCon}}'
- task: Docker@2
displayName: 'Build docker image'
inputs:
command: 'build'
repository: 'allbertcms'
Dockerfile: '**/Dockerfile'
tags: |
${{variables.imageName}}.v.$(Build.BuildId)
${{variables.imageName}}
arguments: '--build-arg SERVER_ADR="${{variables.serverCon}}"'
- task: Docker@2
displayName: 'Push docker image'
inputs:
containerRegistry: 'allbertCommonRegistryConnection'
repository: 'allbertcms'
command: 'push'
tags: |
${{variables.imageName}}.v.$(Build.BuildId)
${{variables.imageName}}