forked from HoussemDellai/aca-course
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
65 lines (58 loc) · 1.49 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
63
64
65
trigger:
branches:
include:
- main
paths:
include:
- azure-pipelines.yaml
exclude:
- Readme.md
resources:
- repo: self
variables:
IMAGE_NAME: houssemdocker/album-backend-api
CONTAINERAPPS_APP: album-backend-api
CONTAINERAPPS_ENVIRONMENT: aca-environment
RESOURCE_GROUP: rg-containerapps-azure-pipelines
TAG: '$(Build.BuildId)'
stages:
- stage: Build
displayName: Build and push image
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build an image
inputs:
command: build
dockerfile: '$(Build.SourcesDirectory)/backend_api/backend_api_csharp/Dockerfile'
repository: $(IMAGE_NAME)
tags: $(TAG)
- task: Docker@2
displayName: Push image to Docker Hub
inputs:
containerRegistry: 'dockerhub-connection'
repository: $(IMAGE_NAME)
command: 'push'
tags: '$(TAG)'
- stage: Deploy
displayName: Deploy to Container Apps
jobs:
- job: Deploy
displayName: Deploy
pool:
vmImage: ubuntu-latest
steps:
- task: AzureContainerApps@1
displayName: Deploy new container version
inputs:
azureSubscription: 'azure-connection'
imageToDeploy: '$(IMAGE_NAME):$(TAG)'
containerAppName: '$(CONTAINERAPPS_APP)'
resourceGroup: '$(RESOURCE_GROUP)'
containerAppEnvironment: '$(CONTAINERAPPS_ENVIRONMENT)'
targetPort: '3500'
ingress: 'external'