forked from WeihanLi/SparkTodo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
44 lines (35 loc) · 1.24 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
# Docker image
# Build a Docker image to deploy, run, or push to a container registry.
# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
pool:
vmImage: 'ubuntu-latest'
variables:
tagName: '$(Build.BuildNumber)'
repoName: 'sparktodo-api'
stableImageName: '$(dockerId)/$(repoName):stable'
latestImageName: '$(dockerId)/$(repoName):latest'
branchImageName: '$(dockerId)/$(repoName):$(Build.SourceBranchName)'
imageName: '$(dockerId)/$(repoName):$(tagName)'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 5.0.x
- script: dotnet build -c Release
displayName: 'dotnet build'
- script: docker build -f Dockerfile -t $(imageName) -t $(latestImageName) .
displayName: 'Docker build Script'
- script: |
docker login -u $(dockerId) -p $(pswd)
docker push $(imageName)
docker push $(latestImageName)
displayName: 'Push docker image'
- task: SSH@0
displayName: 'Run shell inline on remote machine'
inputs:
sshEndpoint: 'weihanli-vm'
runOptions: inline
inline: |
kubectl set image deployment/sparktodo-api sparktodo-api=$(imageName) --record=true