Skip to content

Commit 1e141e0

Browse files
committed
enable multi-arch builds
1 parent 9cb5b71 commit 1e141e0

4 files changed

+87
-34
lines changed

.github/workflows/zeek-build-push-latest-ghcr.yml

+29-11
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ on:
1313
workflow_dispatch:
1414
repository_dispatch:
1515
schedule:
16-
- cron: '0 12 * * 0'
16+
- cron: '0 12 * * *'
1717

1818
env:
1919
REGISTRY: ghcr.io
2020
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/zeek
21-
IMAGE_PLATFORM: linux/amd64
2221
REPO_CONTEXT: .
2322
REPO_CONTAINERFILE: ./Dockerfile.clang
2423
BUILD_FROM_SOURCE: 1
@@ -35,49 +34,64 @@ jobs:
3534
packages: write
3635
contents: read
3736
security-events: write
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
platform:
41+
- linux/amd64
42+
- linux/arm64
3843
steps:
3944
-
4045
name: Cancel previous run in progress
4146
id: cancel-previous-runs
42-
uses: styfle/cancel-workflow-action@0.11.0
47+
uses: styfle/cancel-workflow-action@0.12.1
4348
with:
4449
ignore_sha: true
4550
all_but_latest: true
4651
access_token: ${{ secrets.GITHUB_TOKEN }}
4752
-
4853
name: Checkout
4954
id: repo-checkout
50-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
56+
-
57+
name: Generate arch tag suffix
58+
shell: bash
59+
run: echo "archtag=$([[ "${{ matrix.platform }}" == 'linux/amd64' ]] && echo '' || ( echo -n '-' ; echo "${{ matrix.platform }}" | cut -d '/' -f 2) )" >> $GITHUB_OUTPUT
60+
id: arch_tag_suffix
5161
-
5262
name: Set up QEMU
5363
id: setup-qemu
54-
uses: docker/setup-qemu-action@v2
64+
uses: docker/setup-qemu-action@v3
65+
with:
66+
platforms: ${{ matrix.platform }}
5567
-
5668
name: Log in to registry
5769
id: registry-login
58-
uses: docker/login-action@v2
70+
uses: docker/login-action@v3
5971
with:
6072
registry: ${{ env.REGISTRY }}
6173
username: ${{ github.repository_owner }}
6274
password: ${{ secrets.GITHUB_TOKEN }}
6375
-
6476
name: Build base image
6577
id: build-base-image
66-
uses: docker/build-push-action@v3
78+
uses: docker/build-push-action@v5
6779
with:
6880
context: ${{ env.REPO_CONTEXT }}
6981
file: ${{ env.REPO_CONTAINERFILE }}
7082
push: true
83+
provenance: false
84+
platforms: ${{ matrix.platform }}
7185
target: base
72-
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}
86+
tags: ${{ env.IMAGE_NAME }}:latest${{ steps.arch_tag_suffix.outputs.archtag }},${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}${{ steps.arch_tag_suffix.outputs.archtag }}
7387
build-args: |
7488
BUILD_FROM_SOURCE=${{ env.BUILD_FROM_SOURCE }}
7589
BUILD_JOBS=${{ env.BUILD_JOBS }}
90+
TARGETPLATFORM=${{ matrix.platform }}
7691
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
7792
ZEEK_BRANCH=${{ env.ZEEK_BRANCH }}
7893
ZEEK_DBG=${{ env.ZEEK_DBG }}
7994
MAXMIND_GEOIP_DB_LICENSE_KEY=${{ secrets.MAXMIND_GEOIP_DB_LICENSE_KEY }}
80-
platforms: ${{ env.IMAGE_PLATFORM }}
8195
-
8296
name: Build plus image
8397
id: build-plus-image
@@ -86,17 +100,20 @@ jobs:
86100
context: ${{ env.REPO_CONTEXT }}
87101
file: ${{ env.REPO_CONTAINERFILE }}
88102
push: true
103+
provenance: false
104+
platforms: ${{ matrix.platform }}
89105
target: plus
90-
tags: ${{ env.IMAGE_NAME }}:plus,${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}-plus
106+
tags: ${{ env.IMAGE_NAME }}:plus${{ steps.arch_tag_suffix.outputs.archtag }},${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}-plus${{ steps.arch_tag_suffix.outputs.archtag }}
91107
build-args: |
92108
BUILD_FROM_SOURCE=${{ env.BUILD_FROM_SOURCE }}
93109
BUILD_JOBS=${{ env.BUILD_JOBS }}
110+
TARGETPLATFORM=${{ matrix.platform }}
94111
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
95112
ZEEK_BRANCH=${{ env.ZEEK_BRANCH }}
96113
ZEEK_DBG=${{ env.ZEEK_DBG }}
97-
platforms: ${{ env.IMAGE_PLATFORM }}
98114
-
99115
name: Run Trivy vulnerability scanner
116+
if: ${{ matrix.platform == 'linux/amd64' }}
100117
id: trivy-scan
101118
uses: aquasecurity/trivy-action@master
102119
with:
@@ -112,6 +129,7 @@ jobs:
112129
exit-code: '0'
113130
-
114131
name: Upload Trivy scan results to GitHub Security tab
132+
if: ${{ matrix.platform == 'linux/amd64' }}
115133
uses: github/codeql-action/upload-sarif@v2
116134
if: always()
117135
with:

.github/workflows/zeek-debug-build-push-latest-ghcr.yml

+23-9
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ on:
1313
workflow_dispatch:
1414
repository_dispatch:
1515
schedule:
16-
- cron: '0 12 * * 0'
16+
- cron: '0 12 * * *'
1717

1818
env:
1919
REGISTRY: ghcr.io
2020
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/zeek
21-
IMAGE_PLATFORM: linux/amd64
2221
REPO_CONTEXT: .
2322
REPO_CONTAINERFILE: ./Dockerfile.clang
2423
BUILD_FROM_SOURCE: 1
@@ -35,46 +34,61 @@ jobs:
3534
packages: write
3635
contents: read
3736
security-events: write
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
platform:
41+
- linux/amd64
42+
- linux/arm64
3843
steps:
3944
-
4045
name: Cancel previous run in progress
4146
id: cancel-previous-runs
42-
uses: styfle/cancel-workflow-action@0.11.0
47+
uses: styfle/cancel-workflow-action@0.12.1
4348
with:
4449
ignore_sha: true
4550
all_but_latest: true
4651
access_token: ${{ secrets.GITHUB_TOKEN }}
4752
-
4853
name: Checkout
4954
id: repo-checkout
50-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
56+
-
57+
name: Generate arch tag suffix
58+
shell: bash
59+
run: echo "archtag=$([[ "${{ matrix.platform }}" == 'linux/amd64' ]] && echo '' || ( echo -n '-' ; echo "${{ matrix.platform }}" | cut -d '/' -f 2) )" >> $GITHUB_OUTPUT
60+
id: arch_tag_suffix
5161
-
5262
name: Set up QEMU
5363
id: setup-qemu
54-
uses: docker/setup-qemu-action@v2
64+
uses: docker/setup-qemu-action@v3
65+
with:
66+
platforms: ${{ matrix.platform }}
5567
-
5668
name: Log in to registry
5769
id: registry-login
58-
uses: docker/login-action@v2
70+
uses: docker/login-action@v3
5971
with:
6072
registry: ${{ env.REGISTRY }}
6173
username: ${{ github.repository_owner }}
6274
password: ${{ secrets.GITHUB_TOKEN }}
6375
-
6476
name: Build base image
6577
id: build-base-image
66-
uses: docker/build-push-action@v3
78+
uses: docker/build-push-action@v5
6779
with:
6880
context: ${{ env.REPO_CONTEXT }}
6981
file: ${{ env.REPO_CONTAINERFILE }}
7082
push: true
83+
provenance: false
84+
platforms: ${{ matrix.platform }}
7185
target: base
72-
tags: ${{ env.IMAGE_NAME }}:latest-debug,${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}-debug
86+
tags: ${{ env.IMAGE_NAME }}:latest-debug${{ steps.arch_tag_suffix.outputs.archtag }},${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}-debug${{ steps.arch_tag_suffix.outputs.archtag }}
7387
build-args: |
7488
BUILD_FROM_SOURCE=${{ env.BUILD_FROM_SOURCE }}
7589
BUILD_JOBS=${{ env.BUILD_JOBS }}
90+
TARGETPLATFORM=${{ matrix.platform }}
7691
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
7792
ZEEK_BRANCH=${{ env.ZEEK_BRANCH }}
7893
ZEEK_DBG=${{ env.ZEEK_DBG }}
7994
MAXMIND_GEOIP_DB_LICENSE_KEY=${{ secrets.MAXMIND_GEOIP_DB_LICENSE_KEY }}
80-
platforms: ${{ env.IMAGE_PLATFORM }}

.github/workflows/zeek-debug-build-push-master-ghcr.yml

+23-9
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ on:
1818
env:
1919
REGISTRY: ghcr.io
2020
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/zeek
21-
IMAGE_PLATFORM: linux/amd64
2221
REPO_CONTEXT: .
2322
REPO_CONTAINERFILE: ./Dockerfile.clang
2423
BUILD_FROM_SOURCE: 1
@@ -35,46 +34,61 @@ jobs:
3534
packages: write
3635
contents: read
3736
security-events: write
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
platform:
41+
- linux/amd64
42+
- linux/arm64
3843
steps:
3944
-
4045
name: Cancel previous run in progress
4146
id: cancel-previous-runs
42-
uses: styfle/cancel-workflow-action@0.11.0
47+
uses: styfle/cancel-workflow-action@0.12.1
4348
with:
4449
ignore_sha: true
4550
all_but_latest: true
4651
access_token: ${{ secrets.GITHUB_TOKEN }}
4752
-
4853
name: Checkout
4954
id: repo-checkout
50-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
56+
-
57+
name: Generate arch tag suffix
58+
shell: bash
59+
run: echo "archtag=$([[ "${{ matrix.platform }}" == 'linux/amd64' ]] && echo '' || ( echo -n '-' ; echo "${{ matrix.platform }}" | cut -d '/' -f 2) )" >> $GITHUB_OUTPUT
60+
id: arch_tag_suffix
5161
-
5262
name: Set up QEMU
5363
id: setup-qemu
54-
uses: docker/setup-qemu-action@v2
64+
uses: docker/setup-qemu-action@v3
65+
with:
66+
platforms: ${{ matrix.platform }}
5567
-
5668
name: Log in to registry
5769
id: registry-login
58-
uses: docker/login-action@v2
70+
uses: docker/login-action@v3
5971
with:
6072
registry: ${{ env.REGISTRY }}
6173
username: ${{ github.repository_owner }}
6274
password: ${{ secrets.GITHUB_TOKEN }}
6375
-
6476
name: Build base image
6577
id: build-base-image
66-
uses: docker/build-push-action@v3
78+
uses: docker/build-push-action@v5
6779
with:
6880
context: ${{ env.REPO_CONTEXT }}
6981
file: ${{ env.REPO_CONTAINERFILE }}
7082
push: true
83+
provenance: false
84+
platforms: ${{ matrix.platform }}
7185
target: base
72-
tags: ${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}-debug
86+
tags: ${{ env.IMAGE_NAME }}:${{ env.ZEEK_BRANCH }}-debug${{ steps.arch_tag_suffix.outputs.archtag }}
7387
build-args: |
7488
BUILD_FROM_SOURCE=${{ env.BUILD_FROM_SOURCE }}
7589
BUILD_JOBS=${{ env.BUILD_JOBS }}
90+
TARGETPLATFORM=${{ matrix.platform }}
7691
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
7792
ZEEK_BRANCH=${{ env.ZEEK_BRANCH }}
7893
ZEEK_DBG=${{ env.ZEEK_DBG }}
79-
MAXMIND_GEOIP_DB_LICENSE_KEY=${{ secrets.MAXMIND_GEOIP_DB_LICENSE_KEY }}
80-
platforms: ${{ env.IMAGE_PLATFORM }}
94+
MAXMIND_GEOIP_DB_LICENSE_KEY=${{ secrets.MAXMIND_GEOIP_DB_LICENSE_KEY }}

README.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,15 @@ After building your derivative image, you could run it directly or run `zeek-doc
255255

256256
The [GitHub workflows](.github/workflows) in this repository build and tag the following images:
257257

258-
* `oci.guero.top/zeek:latest` and `oci.guero.top/zeek:v6.2.1`
259-
* `oci.guero.top/zeek:latest-debug` and `oci.guero.top/zeek:v6.2.1-debug`
260-
* `oci.guero.top/zeek:plus` and `oci.guero.top/zeek:v6.2.1-plus`
261-
* `oci.guero.top/zeek:master`
262-
* `oci.guero.top/zeek:master-debug`
258+
* AMD64
259+
- `oci.guero.top/zeek:latest` and `oci.guero.top/zeek:v6.2.1`
260+
- `oci.guero.top/zeek:latest-debug` and `oci.guero.top/zeek:v6.2.1-debug`
261+
- `oci.guero.top/zeek:plus` and `oci.guero.top/zeek:v6.2.1-plus`
262+
- `oci.guero.top/zeek:master`
263+
- `oci.guero.top/zeek:master-debug`
264+
* ARM64
265+
- `oci.guero.top/zeek:latest-arm64` and `oci.guero.top/zeek:v6.2.1-arm64`
266+
- `oci.guero.top/zeek:latest-debug-arm64` and `oci.guero.top/zeek:v6.2.1-debug-arm64`
267+
- `oci.guero.top/zeek:plus-arm64` and `oci.guero.top/zeek:v6.2.1-plus-arm64`
268+
- `oci.guero.top/zeek:master-arm64`
269+
- `oci.guero.top/zeek:master-debug-arm64`

0 commit comments

Comments
 (0)