Paste Search Dynamic
Recent pastes
PHP as Linux Web App on Azure
  1. # PHP as Linux Web App on Azure
  2. # Build, package and deploy your PHP project to Azure Linux Web App.
  3. # Add steps that run tests and more:
  4. # https://docs.microsoft.com/azure/devops/pipelines/languages/php
  5.  
  6. trigger:
  7. - main
  8.  
  9. variables:
  10.   # Azure Resource Manager connection created during pipeline creation
  11.   azureSubscription: '8bfc8df8-9811-45a8-b99d-8029475214c1'
  12.  
  13.   # Web app name
  14.   webAppName: 'test-imageau-win'
  15.  
  16.   # Agent VM image name
  17.   vmImageName: 'ubuntu-latest'
  18.  
  19.   # Environment name
  20.   environmentName: 'test-imageau-win'
  21.  
  22.   # Function app name
  23.   functionAppName: 'fa-imageau-emi-tgo'
  24.  
  25.   # Root folder under which your composer.json file is available.
  26.   rootFolder: $(System.DefaultWorkingDirectory)
  27.  
  28. stages:
  29. - stage: Build
  30.   displayName: Build stage
  31.   variables:
  32.     phpVersion: '7.3'
  33.   jobs:
  34.   - job: BuildJob
  35.     pool:
  36.       vmImage: $(vmImageName)
  37.     steps:
  38.     - script: |
  39.         sudo update-alternatives --set php /usr/bin/php$(phpVersion)
  40.         sudo update-alternatives --set phar /usr/bin/phar$(phpVersion)
  41.         sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion)
  42.         sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion)
  43.         sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion)
  44.         php -version
  45.       workingDirectory: $(rootFolder)
  46.       displayName: 'Use PHP version $(phpVersion)'
  47.  
  48.     - script: composer install --no-interaction --prefer-dist
  49.       workingDirectory: $(rootFolder)
  50.       displayName: 'Composer install'
  51.  
  52.     - task: ArchiveFiles@2
  53.       displayName: 'Archive files'
  54.       inputs:
  55.         rootFolderOrFile: '$(rootFolder)'
  56.         includeRootFolder: false
  57.         archiveType: zip
  58.         archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
  59.         replaceExistingArchive: true
  60.  
  61.     - upload: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
  62.       displayName: 'Upload package'
  63.       artifact: drop
  64.  
  65. - stage: DeployWin
  66.   displayName: 'Deploy Web App Windows'
  67.   dependsOn: Build
  68.   condition: succeeded()
  69.   jobs:
  70.   - deployment: DeploymentJob
  71.     pool:
  72.       vmImage: 'vs2017-win2016'
  73.     environment: $(environmentName)
  74.     strategy:
  75.       runOnce:
  76.         deploy:
  77.           steps:
  78.           - task: AzureFunctionApp@1
  79.             displayName: 'Azure functions app deploy'
  80.             inputs:
  81.               azureSubscription: '$(azureSubscription)'
  82.               appType: functionApp
  83.               appName: $(functionAppName)
  84.               package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
  85.               deploymentMethod: zipDeploy
  86.           - task: AzureCLI@2
  87.             inputs:
  88.               azureSubscription: 'MTC Subscription'
  89.               scriptType: 'bash'
  90.               scriptLocation: 'inlineScript'
  91.               inlineScript: 'az webapp config set --name $(functionAppName) --resource-group TEST-IMAGEAU-WIN --php-version 7.4'
  92.  
Parsed in 0.034 seconds