-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebapi-pipeline.yml
More file actions
49 lines (39 loc) · 1.53 KB
/
webapi-pipeline.yml
File metadata and controls
49 lines (39 loc) · 1.53 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
trigger:
branches:
include:
- master
paths:
include:
- server
pool:
vmImage: ubuntu-latest
variables:
- group: az-credentials
- group: docker-hub
steps:
- script: dotnet build
workingDirectory: $(Build.SourcesDirectory)/server
displayName: Build Solution
- script: dotnet test
workingDirectory: $(Build.SourcesDirectory)/server
displayName: Run Tests
- script: docker build . -t "newdevpleaseignore/fullstackonazure:$(Build.BuildNumber)" -t newdevpleaseignore/fullstackonazure:latest
workingDirectory: $(Build.SourcesDirectory)/server
displayName: Build Docker Image
- script: echo $DOCKER_TOKEN | docker login -u $DOCKER_USERNAME --password-stdin
workingDirectory: $(Build.SourcesDirectory)/server
displayName: Docker Login
env:
DOCKER_USERNAME: $(DOCKER_USERNAME)
DOCKER_TOKEN: $(DOCKER_PASSWORD)
- script: docker image push newdevpleaseignore/fullstackonazure --all-tags
workingDirectory: $(Build.SourcesDirectory)/server
displayName: Docker Push
- script: az login --service-principal --username $ARM_CLIENT_ID --password $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID
displayName: Login to Azure using the AzureDevOps Service Principle
env:
ARM_CLIENT_ID: $(ARM_CLIENT_ID)
ARM_CLIENT_SECRET: $(ARM_CLIENT_SECRET)
ARM_TENANT_ID: $(ARM_TENANT_ID)
- script: az webapp config container set --docker-custom-image-name "newdevpleaseignore/fullstackonazure:$(Build.BuildNumber)" --name $(WebAppName) --resource-group $(WebAppResourceGroup)
displayName: Deploy image to Azure Webapp