diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..ec71d9860 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,48 @@ +variables: + ConnectedServiceName: 'Flask Pipelines' + + # Replace this name to match the name of the App Service you created earlier + WebAppName: 'maddie-pythontest1' + +trigger: +- master + +pool: + vmImage: 'ubuntu-latest' + +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.6' + architecture: 'x64' + +# The | symbol is a continuation character, indicating a multi-line script. +# A single-line script can immediately follows "- script:" without the |. +- script: | + # antenv3.6 is the virtual environment name that App Service expects with + # Python 3.6; use "antenv" for Python 3.7. + python3.6 -m venv antenv3.6 + source antenv3.6/bin/activate + pip3.6 install setuptools + pip3.6 install -r requirements.txt + + # The displayName is shows in the pipeline UI when a build runss + displayName: 'Install Dependencies' + +- task: ArchiveFiles@2 + inputs: + rootFolderOrFile: '$(Build.SourcesDirectory)' + includeRootFolder: false + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/Application$(Build.BuildId).zip' + replaceExistingArchive: true + +- task: AzureRMWebAppDeployment@4 + displayName: Azure App Service Deploy + inputs: + appType: webAppLinux + RuntimeStack: 'PYTHON|3.6' + ConnectedServiceName: $(ConnectedServiceName) + WebAppName: $(WebAppName) + Package: '$(Build.ArtifactStagingDirectory)/Application$(Build.BuildId).zip' + StartupCommand: 'gunicorn --bind=0.0.0.0 --workers=4 startup:app'