Skip to content

Commit 89d1893

Browse files
committed
enable multi-arch build for zeek-build-push-master to test before enabling for others
1 parent b469f1d commit 89d1893

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

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

+22-8
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 }}
86+
tags: ${{ 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 }}

Dockerfile.clang

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
# zeek -C -r /data/foobar.pcap local
3131

3232
########################################################################################################################
33-
FROM debian:12-slim as build
33+
ARG TARGETPLATFORM=linux/amd64
34+
35+
FROM --platform=${TARGETPLATFORM} debian:12-slim
3436

3537
ENV DEBIAN_FRONTEND noninteractive
3638
ENV TERM xterm
@@ -150,7 +152,7 @@ RUN export DEBARCH=$(dpkg --print-architecture) && \
150152
ls -lh /usr/share/src/zeek/build/ | tail -n +2 | cat -n
151153

152154
########################################################################################################################
153-
FROM debian:12-slim as base
155+
FROM --platform=${TARGETPLATFORM} debian:12-slim as base
154156

155157

156158
LABEL maintainer="[email protected]"

Dockerfile.gcc

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
# zeek -C -r /data/foobar.pcap local
3131

3232
########################################################################################################################
33-
FROM debian:12-slim as build
33+
ARG TARGETPLATFORM=linux/amd64
34+
35+
FROM --platform=${TARGETPLATFORM} debian:12-slim as build
3436

3537
ENV DEBIAN_FRONTEND noninteractive
3638
ENV TERM xterm
@@ -144,7 +146,7 @@ RUN export DEBARCH=$(dpkg --print-architecture) && \
144146
ls -lh /usr/share/src/zeek/build/ | tail -n +2 | cat -n
145147

146148
########################################################################################################################
147-
FROM debian:12-slim as base
149+
FROM --platform=${TARGETPLATFORM} debian:12-slim as base
148150

149151

150152
LABEL maintainer="[email protected]"

0 commit comments

Comments
 (0)