-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines.yml
53 lines (44 loc) · 1.92 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
name: $(Build.SourceVersion)
stages:
- stage: Build_docker
dependsOn: []
jobs:
- job: Docker
variables:
dockerId: ulrikaugustsson
imageName: reason-guest-login-oidc-client
pool:
vmImage: ubuntu-16.04
steps:
- script: docker login -u $(dockerId) -p $(dockerPassword)
displayName: "Login to docker"
- script: mkdir -p $(Pipeline.Workspace)/docker-cache
- task: CacheBeta@0
inputs:
key: |
ReasonGuestLoginOidcClient
docker
$(Build.SourcesDirectory)/docker-cache.json
path: $(Pipeline.Workspace)/docker-cache
displayName: Cache Docker image
- script: |
docker load -i $(Pipeline.Workspace)/docker-cache/docker_cache.tar || exit 0
displayName: Load Docker image and layers
# Build the builder stage:
- script: |
docker build --target builder \
--cache-from=$(dockerId)/$(imageName)-builder:latest \
--tag $(dockerId)/$(imageName)-builder:latest .
displayName: "Build builder stage"
- script: docker save $(dockerId)/$(imageName)-builder:latest $(docker history -q $(dockerId)/$(imageName)-builder:latest | grep -v "<missing>") -o $(Pipeline.Workspace)/docker-cache/docker_cache.tar
displayName: Save docker cache
# Build the runtime stage, using cached compile stage:
- script: |
docker build \
--cache-from=$(dockerId)/$(imageName)-builder:latest \
--tag $(dockerId)/$(imageName):$(Build.BuildId) .
displayName: "Build runtime stage"