forked from yllibed/Zigbee2MqttAssistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.buildimage.yaml
57 lines (47 loc) · 1.76 KB
/
azure-pipelines.buildimage.yaml
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
54
55
56
57
parameters:
target: ''
vmImage: ''
imageTag: ''
osTag: ''
# Inspiration for this file: https://www.axians-infoma.de/techblog/creating-a-multi-arch-docker-image-with-azure-devops/
jobs:
- job: ${{ format('build_image_{0}', parameters.osTag) }}
dependsOn: compile_on_windows
pool:
vmImage: ${{ parameters.vmImage }}
variables:
osTag: ${{ parameters.target }}
imageTag: ${{ parameters.imageTag }}
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Restore artifacts compiled on Windows'
inputs:
downloadType: 'all'
downloadPath: '$(Build.ArtifactStagingDirectory)'
- task: DockerInstaller@0
displayName: 'Install docker on CI agent'
inputs:
dockerVersion: '17.09.0-ce'
- task: CopyFiles@2
displayName: 'Copy artifacts to right folder for Docker build'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)/Application/app'
Contents: '**'
TargetFolder: 'Zigbee2MqttAssistant/apppublish'
- task: CmdLine@2
displayName: 'Build docker images'
inputs:
script: |
docker build . -t zigbee2mqttassistant:$(Build.BuildId)-$(osTag) --build-arg DOTNETTAG=$(imageTag) --build-arg OSTAG=$(osTag)
- task: CmdLine@2
displayName: 'save docker images to artifacts'
inputs:
script: |
docker save zigbee2mqttassistant:$(Build.BuildId)-$(osTag) -o "$(Build.ArtifactStagingDirectory)/zigbee2mqttassistant-$(Build.BuildId)-$(osTag).tar"
- task: PublishBuildArtifacts@1
displayName: 'Publish docker images as build artifacts'
condition: always()
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'Application'
publishLocation: 'Container'