-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipeline.yaml
73 lines (66 loc) · 2.32 KB
/
azure-pipeline.yaml
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
trigger:
batch: true
branches:
include:
- develop
- main
pr: none
variables:
agentOS: ubuntu-latest
stages:
# - stage: Env
# displayName: Download and set latest .env
# jobs:
# - job: Env
# pool:
# vmImage: $(agentOS)
# steps:
# - task: DownloadSecureFile@1
# name: envStage
# condition: eq(variables['Build.SourceBranch'], 'refs/heads/develop')
# inputs:
# secureFile: 'env-back-stage'
# - task: Bash@3
# name: setEnvStage
# inputs:
# targetType: 'inline'
# script: 'mv $(envStage.secureFilePath) .env'
- stage: Build
displayName: Build and push docker image
jobs:
- job: Build
pool:
vmImage: $(agentOS)
steps:
- task: Docker@0
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: 'S2s-Service'
azureContainerRegistry: '{"loginServer":"s2sstage.azurecr.io", "id" : "/subscriptions/734fc759-c3a2-4e22-a478-301dc5b10496/resourceGroups/Space2Study/providers/Microsoft.ContainerRegistry/registries/S2sStage"}'
action: 'Build an image'
dockerFile: '**/Dockerfile'
buildArguments: 'MONGODB_URL=$(MONGODB_URL)'
imageName: 'back-stage:$(Build.BuildId)'
- task: Docker@0
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: 'S2s-Service'
azureContainerRegistry: '{"loginServer":"s2sstage.azurecr.io", "id" : "/subscriptions/734fc759-c3a2-4e22-a478-301dc5b10496/resourceGroups/Space2Study/providers/Microsoft.ContainerRegistry/registries/S2sStage"}'
action: 'Push an image'
imageName: 'back-stage:$(Build.BuildId)'
- stage: Deploy
displayName: Deploy image to app service
jobs:
- job: Deploy
pool:
vmImage: $(agentOS)
steps:
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'S2s-Service'
appType: 'webAppContainer'
WebAppName: 's2s-back-stage'
DockerNamespace: 's2sstage.azurecr.io'
DockerRepository: 'back-stage'
DockerImageTag: '$(Build.BuildId)'