Skip to content

Commit 0b484f2

Browse files
committed
#613 - collapse to single-job multi-arch build
Drops the build-client → build-image matrix → merge shape in favor of a single build-and-push job. ng build still runs once natively on amd64, then one buildx --platform linux/amd64,linux/arm64 push produces the multi-arch manifest directly — no per-arch tags, no imagetools merge. The per-arch work left in Dockerfile.prebuilt is just apk add gettext and static COPYs, so native runners bought nothing here. All real CPU work (ng build) already runs native on amd64 outside Docker.
1 parent 4d3d382 commit 0b484f2

1 file changed

Lines changed: 14 additions & 48 deletions

File tree

.github/workflows/client-build.yml

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ env:
88
IMAGE_NAME: northeastern-electric-racing/argos-client
99

1010
jobs:
11-
build-client:
11+
build-and-push:
1212
runs-on: ubuntu-24.04
13+
permissions:
14+
contents: read
15+
packages: write
1316
defaults:
1417
run:
1518
working-directory: ./angular-client
@@ -26,31 +29,14 @@ jobs:
2629
- name: Build production bundle
2730
run: npm run build:production
2831

29-
- uses: actions/upload-artifact@v4
30-
with:
31-
name: client-dist
32-
path: angular-client/dist/angular-client/browser
33-
if-no-files-found: error
32+
# Stage dist where Dockerfile.prebuilt expects it; /dist is in .dockerignore,
33+
# so the docker context can't pull from dist/angular-client/browser directly.
34+
- name: Stage dist into docker context
35+
run: cp -r dist/angular-client/browser browser
3436

35-
build-image:
36-
needs: build-client
37-
strategy:
38-
fail-fast: false
39-
matrix:
40-
include:
41-
- { runner: ubuntu-24.04, platform: linux/amd64, arch: amd64 }
42-
- { runner: ubuntu-24.04-arm, platform: linux/arm64, arch: arm64 }
43-
runs-on: ${{ matrix.runner }}
44-
permissions:
45-
contents: read
46-
packages: write
47-
steps:
48-
- uses: actions/checkout@v6
49-
50-
- uses: actions/download-artifact@v4
37+
- uses: docker/setup-qemu-action@v3
5138
with:
52-
name: client-dist
53-
path: angular-client/browser
39+
platforms: arm64
5440

5541
- uses: docker/setup-buildx-action@v4.0.0
5642

@@ -60,33 +46,13 @@ jobs:
6046
username: ${{ github.actor }}
6147
password: ${{ secrets.GITHUB_TOKEN }}
6248

63-
# No Docker layer cache — apk add gettext is trivial and the dist COPY
64-
# invalidates every run. Real build cost (ng build) lives in build-client.
49+
# Multi-arch in one buildx push — apk add gettext is the only RUN, fine under QEMU.
50+
# All real CPU work (ng build) ran natively above; arch-sensitive part is just the nginx base layer.
6551
- uses: docker/build-push-action@v7.0.0
6652
with:
6753
context: ./angular-client
6854
file: ./angular-client/Dockerfile.prebuilt
6955
push: true
70-
platforms: ${{ matrix.platform }}
71-
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-${{ matrix.arch }}
56+
platforms: linux/amd64,linux/arm64
57+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
7258
provenance: false
73-
74-
merge:
75-
needs: build-image
76-
runs-on: ubuntu-24.04
77-
permissions:
78-
contents: read
79-
packages: write
80-
steps:
81-
- uses: docker/login-action@v4.0.0
82-
with:
83-
registry: ${{ env.REGISTRY }}
84-
username: ${{ github.actor }}
85-
password: ${{ secrets.GITHUB_TOKEN }}
86-
87-
- name: Create multi-arch manifest
88-
run: |
89-
docker buildx imagetools create \
90-
-t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} \
91-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-amd64 \
92-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}-arm64

0 commit comments

Comments
 (0)