forked from microsoft/python-sample-vscode-flask-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb-app-creation-and-app-deployment.yml
More file actions
77 lines (72 loc) · 2.13 KB
/
web-app-creation-and-app-deployment.yml
File metadata and controls
77 lines (72 loc) · 2.13 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
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
# Pipeline to create webapp, build, deploy, and reminder
pool:
vmImage: ubuntu-latest
stages:
# ===============================
# Stage 1: Create Web App
# ===============================
- stage: CreateWebApp
displayName: Create Web App on Azure
jobs:
- job: CreateApp
displayName: Create app via CLI
steps:
- task: AzureCLI@2
displayName: "Create Web App if not exists"
inputs:
azureSubscription: SPN-Dev-01
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
if az webapp show --name flaskappgmd28 --resource-group AZ400-play &>/dev/null; then
echo "Web app already exists, skipping creation"
else
az webapp create --resource-group AZ400-play --plan ASP-AzureAppIncidentProjectgroup-8d3f --name flaskappgmd28 --runtime "PYTHON:3.10"
fi
# ===============================
# Stage 2: Build Python App
# ===============================
- stage: BuildApp
displayName: 'Build Python Stage'
dependsOn: CreateWebApp
jobs:
- job: BuildAppOnDevops
displayName: 'Build App on DevOps'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
addToPath: true
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
displayName: 'Install dependencies'
# ===============================
# Stage 3: Deploy App
# ===============================
- stage: DeployApp
displayName: 'Deploy App Stage'
dependsOn: BuildApp
jobs:
- job: DeployToAzure
displayName: 'Deploy Build App to Azure'
steps:
- task: AzureWebApp@1
inputs:
azureSubscription: SPN-Dev-01
appType: webApp
appName: flaskappgmd28
package: '$(System.DefaultWorkingDirectory)'
startupCommand: 'gunicorn --bind 0.0.0.0:8000 app:app'
# ===============================
# Stage 4: Reminder
# ===============================
- stage: ReminderToDelete
displayName: 'Reminder to delete'
dependsOn: DeployApp
jobs:
- job: Reminder
displayName: 'Text reminder'
steps:
- script: |
echo "Delete or at least stop"