-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-build-deploy-template.yml
50 lines (48 loc) · 1.44 KB
/
docker-build-deploy-template.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
# Docker build template
parameters:
- name: profile
type: string
- name: tags
type: string
- name: containerRegistry
type: string
- name: targetArchitecture
type: string
default: 'x64'
- name: useCache
type: boolean
default: true
jobs:
- job: Build_${{ parameters.profile }}
displayName: Build image ${{ parameters.profile }}
pool:
name: Default
# vmImage: ubuntu-latest
steps:
- checkout: self
submodules: recursive
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: ${{ parameters.containerRegistry }}
- ${{ if eq(parameters.targetArchitecture, 'arm64') }}:
- script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- task: Docker@2
displayName: Building image ${{ parameters.profile }}
inputs:
command: build
dockerfile: '$(Build.SourcesDirectory)/Dockerfile.${{ parameters.profile }}'
repository: rubyrhod/${{ parameters.profile }}
tags: ${{ parameters.tags }}
${{ if not(parameters.useCache) }}:
arguments: --no-cache
- task: Docker@2
displayName: Pushing image ${{ parameters.profile }} to registry $${{ parameters.containerRegistry }}
inputs:
command: push
containerRegistry: ${{ parameters.containerRegistry }}
repository: rubyrhod/${{ parameters.profile }}
tags: ${{ parameters.tags }}
- script: docker image prune -f
displayName: Pruning dangling images