Skip to content

Commit 22448fc

Browse files
authored
Create azure-pipelines.yml
Updated
1 parent 72566af commit 22448fc

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Python to Linux Web App on Azure
2+
# Build your Python project and deploy it to Azure as a Linux Web App.
3+
# Change python version to one thats appropriate for your application.
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5+
6+
trigger:
7+
- main
8+
9+
variables:
10+
# Azure Resource Manager connection created during pipeline creation
11+
azureServiceConnectionId: '7e9c32cf-a856-4c63-8168-ee2d580b91bd'
12+
13+
# Web app name
14+
webAppName: 'EOAgriTool'
15+
16+
# Agent VM image name
17+
vmImageName: 'ubuntu-latest'
18+
19+
# Environment name
20+
environmentName: 'EOAgriTool'
21+
22+
# Project root folder. Point to the folder containing manage.py file.
23+
projectRoot: $(System.DefaultWorkingDirectory)
24+
25+
pythonVersion: '3.9'
26+
27+
stages:
28+
- stage: Build
29+
displayName: Build stage
30+
jobs:
31+
- job: BuildJob
32+
pool:
33+
vmImage: $(vmImageName)
34+
steps:
35+
- task: UsePythonVersion@0
36+
inputs:
37+
versionSpec: '$(pythonVersion)'
38+
displayName: 'Use Python $(pythonVersion)'
39+
40+
- script: |
41+
python -m venv antenv
42+
source antenv/bin/activate
43+
python -m pip install --upgrade pip
44+
pip install setup
45+
pip install -r requirements.txt
46+
workingDirectory: $(projectRoot)
47+
displayName: "Install requirements"
48+
49+
- task: ArchiveFiles@2
50+
displayName: 'Archive files'
51+
inputs:
52+
rootFolderOrFile: '$(projectRoot)'
53+
includeRootFolder: false
54+
archiveType: zip
55+
archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
56+
replaceExistingArchive: true
57+
58+
- upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
59+
displayName: 'Upload package'
60+
artifact: drop
61+
62+
- stage: Deploy
63+
displayName: 'Deploy Web App'
64+
dependsOn: Build
65+
condition: succeeded()
66+
jobs:
67+
- deployment: DeploymentJob
68+
pool:
69+
vmImage: $(vmImageName)
70+
environment: $(environmentName)
71+
strategy:
72+
runOnce:
73+
deploy:
74+
steps:
75+
76+
- task: UsePythonVersion@0
77+
inputs:
78+
versionSpec: '$(pythonVersion)'
79+
displayName: 'Use Python version'
80+
81+
- task: AzureWebApp@1
82+
displayName: 'Deploy Azure Web App : EOAgriTool'
83+
inputs:
84+
azureSubscription: $(azureServiceConnectionId)
85+
appName: $(webAppName)
86+
package: $(Pipeline.Workspace)/drop/$(Build.BuildId).zip

0 commit comments

Comments
 (0)