forked from OpenHack-DevOpsTeam1/source
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines-user-java-cd.yml
More file actions
60 lines (55 loc) · 1.62 KB
/
azure-pipelines-user-java-cd.yml
File metadata and controls
60 lines (55 loc) · 1.62 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
branches:
include:
- main
paths:
include:
- apis/user-java
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
azureSubscription: 'Azure subscription 1' # Name of the Service Connection
appName: openhackyvs74zq0userjava
dockerRegistryServiceConnection: '9abbaa7b-554b-4d60-9fa6-f2e4f71f20f1'
imageRepository: 'devopsoh/api-user-java'
containerRegistry: 'openhackyvs74zq0acr.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/apis/user-java/Dockerfile'
tag: '$(Build.SourceVersion)'
# Agent VM image name
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- stage: Deploy
displayName: Deploy Container to Web App
jobs:
- job: Deploy
displayName: Deploy
pool:
vmImage: $(vmImageName)
steps:
- task: AzureWebAppContainer@1
displayName: 'Azure Web App on Container Deploy'
inputs:
azureSubscription: $(azureSubscription)
appName: $(appName)
containers: $(containerRegistry)/$(imageRepository):$(tag)