-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
42 lines (37 loc) · 1.11 KB
/
azure-pipelines.yml
File metadata and controls
42 lines (37 loc) · 1.11 KB
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
trigger:
- main
- develop
pool:
vmImage: 'ubuntu-latest'
variables:
DOCKER_BUILDKIT: 1
# Define different tags for main and develop branches
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}:
imageTag: '$(Build.BuildId)' # Unique tag for production
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/develop') }}:
imageTag: 'dev' # Static tag for development
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)