-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yaml
47 lines (42 loc) · 1.27 KB
/
azure-pipelines.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
trigger:
- master
pool:
vmImageName: 'ubuntu-latest'
stages:
- stage: Build_and_Push
displayName: Build and Push stage
jobs:
- job: BuildandPushJob
displayName: Build and Push Job
steps:
- task: Docker@0
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerFile: Dockerfile
imageName: '9870050478/springboot-petclinic-docker:$(Build.BuildId)'
- task: Docker@0
displayName: 'Push an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: dockerhub
action: 'Push an image'
imageName: '9870050478/springboot-petclinic-docker:$(Build.BuildId)'
- stage: Deploy
displayName: Deploy stage
dependsOn: Build_and_Push
condition: succeeded()
jobs:
- deployment: DeploytoEC2Instance
displayName: Deploy to EC2 Instance
environment: 'development'
strategy:
runOnce:
deploy:
steps:
- task: SSH@0
displayName: 'Run shell commands on remote machine'
inputs:
sshEndpoint: 'ec2-instance'
commands: |
docker run -it -d -p 8081:8080 --name springboot-petclinic 9870050478/springboot-petclinic-docker:$(Build.BuildId)