-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
102 lines (78 loc) · 2.57 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
# variables:
# PORT: $(PORT)
# REACT_APP_API: $(REACT_APP_API)
# MONGO_URL: $(MONGO_URL)
# JWT_SECRET: $(JWT_SECRET)
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSource: 'spec'
versionSpec: '18.18.0'
# ls -lrta
- task: Bash@3
inputs:
targetType: 'inline'
script: |
cd $(System.DefaultWorkingDirectory)/client
npm install
npm i nodemon
touch .env
REACT_APP_API= $(REACT_APP_API) >> .env
cat .env
npm run build
ls -lrta $(System.DefaultWorkingDirectory)/client
# npm run build
- task: Bash@3
inputs:
targetType: 'inline'
script: |
cd $(System.DefaultWorkingDirectory)
npm install
npm i nodemon
npm i path
touch .env
MONGO_URL=$(MONGO_URL)>> .env
PORT=$(PORT) >> .env
JWT_SECRET=$(JWT_SECRET) >> .env
cat .env
ls -lrta $(System.DefaultWorkingDirectory)
- task: Docker@0
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: 'Service-Connection-TECH-DEMO'
azureContainerRegistry: '{"loginServer":"acrwebapp1.azurecr.io", "id" : "/subscriptions/55dd3384-2263-4ac8-9b80-09308ab7787f/resourceGroups/rg-webapp-01/providers/Microsoft.ContainerRegistry/registries/acrwebapp1"}'
action: 'Build an image'
dockerFile: '**/Dockerfile'
imageName: 'webapp:$(Build.BuildId)'
- task: Docker@0
displayName: Push docker image
inputs:
containerregistrytype: 'Azure Container Registry'
azureSubscription: 'Service-Connection-TECH-DEMO'
azureContainerRegistry: '{"loginServer":"acrwebapp1.azurecr.io", "id" : "/subscriptions/55dd3384-2263-4ac8-9b80-09308ab7787f/resourceGroups/rg-webapp-01/providers/Microsoft.ContainerRegistry/registries/acrwebapp1"}'
action: 'Push an image'
imageName: 'webapp:$(Build.BuildId)'
# - task: AzureWebAppContainer@1
# inputs:
# azureSubscription: 'Service-Connection-TECH-DEMO'
# appName: 'react-webapp11'
# containers: 'acrwebapp1.azurecr.io/webapp:276'
# containerCommand: 'npm run dev'
- task: AzureRmWebAppDeployment@4
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Service-Connection-TECH-DEMO'
appType: 'webAppContainer'
WebAppName: 'app-webapps11'
DockerNamespace: 'acrwebapp1.azurecr.io'
DockerRepository: 'webapp'
DockerImageTag: '$(Build.BuildId)'
StartupCommand: 'npm run dev'