From 7c45d946dbc8e26ce437dd24c8a44a6ad4f2b5ff Mon Sep 17 00:00:00 2001 From: Christopher Costa Date: Mon, 27 Apr 2026 15:18:14 +0100 Subject: [PATCH] Support ARM architecture --- .github/workflows/ambar-task-explorer.yaml | 16 ++++++++++++++++ task-explorer/Dockerfile | 9 +++++++-- task-explorer/package.json | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ambar-task-explorer.yaml b/.github/workflows/ambar-task-explorer.yaml index 0d3e62a..f426429 100644 --- a/.github/workflows/ambar-task-explorer.yaml +++ b/.github/workflows/ambar-task-explorer.yaml @@ -101,6 +101,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 + # QEMU registers binfmt handlers so buildx can RUN steps for non-native + # platforms via emulation (we publish linux/amd64 + linux/arm64; the + # runner is amd64, so arm64 RUN steps need QEMU). + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -117,8 +123,13 @@ jobs: with: context: ./task-explorer push: false + # Validate both architectures at PR time so arm64-only build + # failures don't slip through to a post-merge publish. + platforms: linux/amd64,linux/arm64 build-args: | GITHUB_TOKEN=${{ secrets.READ_ACCESS_TO_REPOS }} + cache-from: type=gha,scope=task-explorer + cache-to: type=gha,mode=max,scope=task-explorer - name: Extract version if: github.ref == 'refs/heads/main' @@ -131,8 +142,13 @@ jobs: with: context: ./task-explorer push: true + # Multi-arch manifest list — Ambar staging EKS nodes are arm64, + # local dev (Docker Desktop, Linux laptops) is typically amd64. + platforms: linux/amd64,linux/arm64 tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.value }} build-args: | GITHUB_TOKEN=${{ secrets.READ_ACCESS_TO_REPOS }} + cache-from: type=gha,scope=task-explorer + cache-to: type=gha,mode=max,scope=task-explorer diff --git a/task-explorer/Dockerfile b/task-explorer/Dockerfile index afab4e8..dfc50c2 100644 --- a/task-explorer/Dockerfile +++ b/task-explorer/Dockerfile @@ -1,4 +1,8 @@ FROM node:24.0.0-alpine AS frontend-builder +# TARGETPLATFORM is set automatically by buildx (e.g. "linux/amd64", +# "linux/arm64"). We thread it into the pnpm-store cache id so each platform +# gets its own cache namespace under multi-arch builds. +ARG TARGETPLATFORM WORKDIR /app/frontend RUN apk add --no-cache git @@ -11,7 +15,7 @@ RUN : "${GITHUB_TOKEN:?Required build argument GITHUB_TOKEN not set}" COPY ./frontend/package.json ./package.json COPY ./.npmrc ./.npmrc -RUN --mount=type=cache,id=pnpm-store-arm64,target=/root/.local/share/pnpm/store pnpm install +RUN --mount=type=cache,id=pnpm-store-${TARGETPLATFORM},target=/root/.local/share/pnpm/store pnpm install COPY ./frontend/src ./src COPY ./frontend/public ./public @@ -22,6 +26,7 @@ ENV VITE_BASE_PATH=${VITE_BASE_PATH} RUN pnpm run build FROM node:24.0.0-alpine AS backend-builder +ARG TARGETPLATFORM WORKDIR /app/backend RUN apk add --no-cache git @@ -34,7 +39,7 @@ RUN : "${GITHUB_TOKEN:?Required build argument GITHUB_TOKEN not set}" COPY ./backend/package.json ./package.json COPY ./.npmrc ./.npmrc -RUN --mount=type=cache,id=pnpm-store-arm64,target=/root/.local/share/pnpm/store pnpm install +RUN --mount=type=cache,id=pnpm-store-${TARGETPLATFORM},target=/root/.local/share/pnpm/store pnpm install COPY ./backend/src ./src COPY ./backend/tests ./tests diff --git a/task-explorer/package.json b/task-explorer/package.json index 702e9b4..0fe90c8 100644 --- a/task-explorer/package.json +++ b/task-explorer/package.json @@ -1,7 +1,7 @@ { "name": "task-explorer", "private": true, - "version": "0.1.0", + "version": "0.1.1", "scripts": { "dev:frontend": "pnpm --filter './frontend' dev -- --host 0.0.0.0", "dev:api": "pnpm --filter './backend' dev",