Last active
April 4, 2020 23:48
-
-
Save iqan/f91223ae77e0bc81e17e7520603a6884 to your computer and use it in GitHub Desktop.
Azure pipeline configuration file to Build, push an image to Azure Container Registry and Deploy to Web App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Docker | |
| # Build, push an image to Azure Container Registry and Deploy to Web App | |
| # https://docs.microsoft.com/azure/devops/pipelines/languages/docker | |
| trigger: | |
| - master | |
| resources: | |
| - repo: self | |
| variables: | |
| # Container registry service connection established during pipeline creation | |
| dockerRegistryServiceConnection: '<YOUR_DETAILS>' | |
| imageRepository: '<YOUR_IMAGE_NAME>' | |
| containerRegistry: '<YOUR_ACR>.azurecr.io' | |
| dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile' | |
| tag: '$(Build.BuildId)' | |
| # Agent VM image name | |
| vmImageName: 'ubuntu-latest' | |
| stages: | |
| - stage: Build | |
| displayName: Build and push stage | |
| jobs: | |
| - job: Build | |
| displayName: Build | |
| pool: | |
| vmImage: $(vmImageName) | |
| steps: | |
| - task: Docker@2 | |
| displayName: Build and push an image to container registry | |
| inputs: | |
| command: buildAndPush | |
| repository: $(imageRepository) | |
| dockerfile: $(dockerfilePath) | |
| containerRegistry: $(dockerRegistryServiceConnection) | |
| tags: | | |
| $(tag) | |
| - stage: deploy | |
| displayName: Deploy app to Azure WebApp | |
| jobs: | |
| - job: Deploy | |
| displayName: Deploy | |
| pool: | |
| vmImage: $(vmImageName) | |
| steps: | |
| - task: AzureRmWebAppDeployment@4 | |
| inputs: | |
| ConnectionType: 'AzureRM' | |
| azureSubscription: '<YOUR_SUBSCRIPTION_DETAILS>' | |
| appType: 'webAppContainer' | |
| WebAppName: '<YOUR_APP_NAME>' | |
| DockerNamespace: '$(containerRegistry)' | |
| DockerRepository: '$(imageRepository)' | |
| DockerImageTag: '$(tag)' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment