Skip to content

Commit ca240dd

Browse files
committed
Add support for arm64 images
Signed-off-by: Paulo Gomes <pjbgf@linux.com>
1 parent 36f006d commit ca240dd

File tree

2 files changed

+45
-17
lines changed

2 files changed

+45
-17
lines changed

.github/workflows/pr.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,24 @@ on:
1010
permissions: {}
1111

1212
env:
13-
REGISTRY: ghcr.io/${{ github.repository }}
13+
REGISTRY: localhost:5000/qubesome
1414
TAG: smoke-test
1515

1616
jobs:
1717
build-images:
18-
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
platform: [ubuntu-latest, ubuntu-24.04-arm]
22+
23+
runs-on: ${{ matrix.platform }}
24+
25+
services:
26+
registry:
27+
image: registry:3
28+
ports:
29+
- 5000:5000
30+
1931
steps:
2032
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2133
with:
@@ -26,10 +38,11 @@ jobs:
2638

2739
- name: Setup Docker Buildx
2840
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
41+
with:
42+
driver-opts: network=host
2943

30-
- name: Build images
31-
run: |
32-
make build
44+
- name: Test build and push of images
45+
run: make push
3346

3447
- name: Smoke test binaries
3548
run: |

Makefile

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
11
REGISTRY ?= workload-images
22
TAG ?= latest
33

4-
BUILDER ?= docker
5-
RUNNER ?= docker
4+
BUILDER ?= docker buildx
65

76
WORKLOADS=$(shell find workloads -mindepth 2 -maxdepth 2 -type f -name 'Dockerfile' | sort -u | cut -f 2 -d'/')
87
TOOLS=$(shell find tools -mindepth 2 -maxdepth 2 -type f -name 'Dockerfile' | sort -u | cut -f 2 -d'/')
98

10-
build:
9+
MACHINE = qubesome
10+
11+
# ACTION can only be --load when TARGET_PLATFORM is the current platform:
12+
# TARGET_PLATFORMS=linux/amd64 ACTION=--load make push-workload-xorg
13+
ACTION ?= --load
14+
TARGET_PLATFORMS ?= $(shell docker info --format '{{.ClientInfo.Os}}/{{.ClientInfo.Arch}}')
15+
SUPPORTED_PLATFORMS = linux/amd64,linux/arm64
16+
17+
build: build-workload-base
1118
$(MAKE) $(addprefix build-workload-, $(WORKLOADS))
1219
$(MAKE) $(addprefix build-tool-, $(TOOLS))
1320

14-
build-workload-%:
21+
buildx-machine:
22+
$(BUILDER) use $(MACHINE) >/dev/null 2>&1 || \
23+
$(BUILDER) create --name=$(MACHINE) --platform=$(SUPPORTED_PLATFORMS)
24+
25+
build-workload-%: buildx-machine
1526
cd workloads/$(subst :,/,$*); \
16-
$(BUILDER) build --build-arg=REGISTRY=$(REGISTRY) --build-arg=TAG=$(TAG) \
17-
--load -t $(REGISTRY)/$(subst :,/,$*):$(TAG) -f Dockerfile .
27+
$(BUILDER) build --builder $(MACHINE) --platform="$(TARGET_PLATFORMS)" \
28+
--build-arg=REGISTRY=$(REGISTRY) --build-arg=TAG=$(TAG) \
29+
$(ACTION) -t $(REGISTRY)/$(subst :,/,$*):$(TAG) -f Dockerfile .
1830

19-
build-tool-%:
31+
build-tool-%: buildx-machine
2032
cd tools/$(subst :,/,$*); \
21-
$(BUILDER) build --build-arg=REGISTRY=$(REGISTRY) --build-arg=TAG=$(TAG) \
22-
-t $(REGISTRY)/$(subst :,/,$*):$(TAG) -f Dockerfile .
33+
$(BUILDER) build --builder $(MACHINE) --platform="$(TARGET_PLATFORMS)" \
34+
--build-arg=REGISTRY=$(REGISTRY) --build-arg=TAG=$(TAG) \
35+
$(ACTION) -t $(REGISTRY)/$(subst :,/,$*):$(TAG) -f Dockerfile .
2336

2437
push:
2538
$(MAKE) $(addprefix push-workload-, $(WORKLOADS))
2639
$(MAKE) $(addprefix push-tool-, $(TOOLS))
2740

28-
push-workload-%: build-workload-%
29-
cd workloads/$(subst :,/,$*); \
30-
$(BUILDER) push $(REGISTRY)/$(subst :,/,$*):$(TAG)
41+
push-workload-%:
42+
ACTION=--push \
43+
TARGET_PLATFORMS=$(SUPPORTED_PLATFORMS) \
44+
$(MAKE) build-workload-$(subst :,/,$*)
45+
3146
ifneq ($(TAG),latest)
3247
cosign sign --yes "$(REGISTRY)/$(subst :,/,$*):$(TAG)"
3348
endif

0 commit comments

Comments
 (0)