-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
50 lines (43 loc) · 1.07 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
# Docker
# Build a Docker image
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- main
resources:
- repo: self
variables:
tag: 'latest' # '$(Build.BuildId)'
stages:
- stage: Build
displayName: Dockerize App
jobs:
- job: Job1
displayName: Docker Build and push
pool:
name: Default
# vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Build an image
inputs:
containerRegistry: 'docker-registry'
repository: 'abubakarriaz/blogi-backend'
command: buildAndPush
dockerfile: '$(Build.SourcesDirectory)/src/Dockerfile'
tags: $(tag)
- stage: deploy
displayName: Deploy to VM
dependsOn: Build
condition:
jobs:
- job: Job1
displayName: SSH and docker container up
pool:
name: Default
steps:
- task: SSH@0
inputs:
sshEndpoint: 'service-connection-ssh-vm'
runOptions: 'commands'
commands: 'docker run -d -p 8100:80 --name blogi-backend-server-01 abubakarriaz/blogi-backend:latest'
readyTimeout: '20000'