-
Notifications
You must be signed in to change notification settings - Fork 14
133 lines (119 loc) · 4.19 KB
/
build_container.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Release Mondoo Container Image
on:
release:
types: [released]
workflow_dispatch:
jobs:
build_container:
runs-on: ubuntu-latest
timeout-minutes: 10
name: Build Docker
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Latest Tag
id: vars
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Parse semver string
id: semver
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ steps.vars.outputs.tag }}
- name: Clean Version Tag
id: version
run: |
VERSION=$(echo "${{ steps.vars.outputs.tag }}" | sed -e 's/^v//')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
image: tonistiigi/binfmt:latest
platforms: arm64,arm
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push root images
uses: docker/build-push-action@v6
with:
sbom: true
provenance: true
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: VERSION=${{ steps.version.outputs.version }}
target: root
tags: |
mondoolabs/mondoo:${{ steps.version.outputs.version }}
mondoolabs/mondoo:${{ steps.semver.outputs.major }}
mondoolabs/mondoo:latest
mondoo/client:${{ steps.version.outputs.version }}
mondoo/client:${{ steps.semver.outputs.major }}
mondoo/client:latest
- name: Build and push devkit images
# make it optional until we fixed https://github.com/mondoohq/cnquery/issues/3107
continue-on-error: true
uses: docker/build-push-action@v6
with:
sbom: true
provenance: true
context: .
file: Dockerfile-dev
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: true
build-args: VERSION=${{ steps.version.outputs.version }}
target: root
tags: |
mondoo/devkit:${{ steps.version.outputs.version }}
mondoo/devkit:${{ steps.semver.outputs.major }}
mondoo/devkit:latest
- name: Build and push rootless images
uses: docker/build-push-action@v6
with:
sbom: true
provenance: true
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: true
build-args: VERSION=${{ steps.version.outputs.version }}
target: rootless
tags: |
mondoo/client:${{ steps.version.outputs.version }}-rootless
mondoo/client:${{ steps.semver.outputs.major }}-rootless
mondoo/client:latest-rootless
- name: Build and push root images (ubi)
uses: docker/build-push-action@v6
with:
sbom: true
provenance: true
context: .
file: Dockerfile-ubi
platforms: linux/amd64,linux/arm64
push: true
build-args: VERSION=${{ steps.version.outputs.version }}
target: root
tags: |
mondoo/client:${{ steps.version.outputs.version }}-ubi
mondoo/client:${{ steps.semver.outputs.major }}-ubi
mondoo/client:latest-ubi
- name: Build and push rootless images (ubi)
uses: docker/build-push-action@v6
with:
sbom: true
provenance: true
context: .
file: Dockerfile-ubi
platforms: linux/amd64,linux/arm64
push: true
build-args: VERSION=${{ steps.version.outputs.version }}
target: rootless
tags: |
mondoo/client:${{ steps.version.outputs.version }}-ubi-rootless
mondoo/client:${{ steps.semver.outputs.major }}-ubi-rootless
mondoo/client:latest-ubi-rootless