-
Notifications
You must be signed in to change notification settings - Fork 2
/
azure-pipelines.yml
97 lines (86 loc) · 2.71 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
# Python to Linux Web App on Azure
# Build your Python project and deploy it to Azure as a Linux Web App.
trigger:
- master
variables:
# Agent VM image name
vmImageName: 'ubuntu-latest'
# Project root folder. Point to the folder containing manage.py file.
projectRoot: $(System.DefaultWorkingDirectory)
zipRoot: $(Build.ArtifactStagingDirectory)
buildId: $(Build.BuildId)
# Python version
pythonVersion: '3.7'
stages:
- stage: Build
displayName: Build app
jobs:
- job: BuildJob
displayName: "Build Job"
pool:
vmImage: $(vmImageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
displayName: 'Use Python $(pythonVersion)'
- script: |
python -m venv antenv
source antenv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
workingDirectory: $(projectRoot)
displayName: "Install requirements"
# - bash: echo "##vso[task.prependpath]$CONDA/bin"
# displayName: "Add conda to PATH"
#
# - script: |
# conda env create -v --quiet --force --file environment.yml -p $PWD/envs/compliance-dashboard
# displayName: "Install requirements"
#
# # Show Conda Build Env
# - script: |
# echo "cwd:" `pwd`
# eval "$(conda shell.bash hook)"
# conda activate $PWD/envs/compliance-dashboard
# conda env list
# conda list
# displayName: 'Show build environment'
# continueOnError: true
- task: ArchiveFiles@2
displayName: 'Archive files'
inputs:
rootFolderOrFile: '$(projectRoot)'
includeRootFolder: false
archiveType: zip
archiveFile: $(zipRoot)/$(buildId).zip
replaceExistingArchive: true
- upload: $(zipRoot)/$(buildId).zip
displayName: 'Upload package'
artifact: drop
- stage: Deploy
displayName: "Deploy app"
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeploymentJob
displayName: "Deploy Job"
pool:
vmImage: $(vmImageName)
environment: $(projectName)
strategy:
runOnce:
deploy:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
displayName: 'Use Python $(pythonVersion)'
- task: AzureWebApp@1
displayName: 'Deploy Azure Web App - $(projectName)'
inputs:
azureSubscription: $(azureServiceConnectionId)
appName: $(projectName)
appType: 'webAppLinux'
package: $(Pipeline.Workspace)/drop/$(buildId).zip
startUpCommand: 'gunicorn -c=gunicorn.conf.py app:server' #PATH="/home/site/wwwroot/envs/compliance-dashboard/bin:$PATH"