Skip to content
This repository has been archived by the owner on Oct 19, 2019. It is now read-only.

Commit

Permalink
feat(azure-devops): add deploy container to app services
Browse files Browse the repository at this point in the history
  • Loading branch information
julie-ng committed Apr 18, 2019
1 parent 9737d2f commit b80e60c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,17 @@ steps:

See full [azure-pipelines.yml](./azure-pipelines.yml) file for details.

## Deployment

Before you deploy, you need to create the resource (e.g. first deploy) by hand. Otherwise you may see this error message:

```
##[error]Error: Resource 'azure-devops-acr-example' doesn't exist. Resource should exist before deployment.
```

## References

- [Azure Pipelines: Build, test, and push Docker container apps](https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/docker?view=azure-devops)
- [Azure Pipelines: Docker task](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/docker?view=azure-devops)

- [Azure Pipelines: Specify conditions](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml)
- [Azure Pipelines > Deploy Tasks: Azure Web App for Container task](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-containers?view=azure-devops)
2 changes: 1 addition & 1 deletion app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ app.use(helmet())
app.use(logger('dev'))

app.get('/', (req, res) => {
res.send('Hello World!')
res.send('Hello World! V2')
})

app.use((req, res, next) => {
Expand Down
12 changes: 11 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ variables:
azureContainerRegistry: julie.azurecr.io
registryName: $(azureContainerRegistry)/$(Build.Repository.Name)
imageTag: $(registryName):$(Build.BuildId)
appName: azure-devops-acr-example

pool:
vmImage: 'Ubuntu-16.04'
Expand Down Expand Up @@ -52,4 +53,13 @@ steps:
displayName: 'Docker: Push image'

- script: docker logout $(azureContainerRegistry)
displayName: 'Docker: logout ACR'
displayName: 'Docker: logout ACR'

# Only deploy master branch if previous steps successful
- task: AzureWebAppContainer@1
displayName: Deploy container as Azure Web App
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
appName: $(appName)
azureSubscription: $(azureSubscriptionEndpoint)
imageName: $(imageTag)-$(buildSha)

0 comments on commit b80e60c

Please sign in to comment.