-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
62 lines (56 loc) · 1.75 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
57
58
59
60
61
62
trigger:
- main
- development
pool:
vmImage: 'ubuntu-latest'
variables:
DOCKER_BUILDKIT: 1
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
imageTag: '$(Build.BuildId)'
appServiceName: 'myfeatures'
BUILD_ENV: 'production' # Angular build env
DOTNET_ENV: 'Production' # .NET environment
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/development') }}:
imageTag: 'dev'
appServiceName: 'myfeaturesdev'
BUILD_ENV: 'staging' # Angular build env
DOTNET_ENV: 'Staging' # .NET environment
stages:
- stage: BuildAndPush
jobs:
- job: Build
steps:
- task: Docker@2
displayName: 'Login to Azure Container Registry'
inputs:
containerRegistry: 'my-service-connection'
command: 'login'
- task: Docker@2
displayName: 'Build Docker Image'
inputs:
containerRegistry: 'my-service-connection'
repository: 'myfeaturescontainerregistry/acr-repository-3'
command: 'build'
Dockerfile: 'Dockerfile'
buildContext: '.'
arguments: '--build-arg BUILD_ENV=$(BUILD_ENV) --build-arg DOTNET_ENV=$(DOTNET_ENV)'
tags: |
$(imageTag)
- task: Docker@2
displayName: 'Push Docker Image'
inputs:
containerRegistry: 'my-service-connection'
repository: 'myfeaturescontainerregistry/acr-repository-3'
command: 'push'
tags: |
$(imageTag)
- stage: Deploy
condition: succeeded()
jobs:
- job: DeployWebApp
steps:
- task: AzureWebAppContainer@1
inputs:
azureSubscription: 'arm-service-connection'
appName: '$(appServiceName)'
containers: 'myfeaturescontainerregistry.azurecr.io/myfeaturescontainerregistry/acr-repository-3:$(imageTag)'