forked from districtr/districtr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
33 lines (26 loc) · 1.11 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Docker image
# Build a Docker image to deploy, run, or push to a container registry.
# Add steps that use Docker Compose, tag images, push to a registry, run an image, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
pool:
vmImage: "Ubuntu 16.04"
variables:
imageName: "$(dockerId)/districtr-frontend:$(build.buildId)"
steps:
- script: npm install
displayName: Install dependencies
- script: npm run test-ci
displayName: Run tests
- task: PublishTestResults@2
inputs:
testResultsFormat: XUnit
testResultsFiles: "**/test-results.xml"
testRunTitle: "Test results for JavaScript"
- script: docker build -f Dockerfile -t $(imageName) .
displayName: "Build Docker image"
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/staging'))
- script: |
echo $(dockerPassword) | docker login -u $(dockerId) --password-stdin
docker push $(imageName)
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/staging'))
displayName: "Push Docker image"