diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 56a1fda..497c667 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -195,6 +195,8 @@ jobs: tags: rivetdev/sandbox-agent:${{ steps.vars.outputs.sha_short }}${{ matrix.arch_suffix }} file: docker/runtime/Dockerfile platforms: ${{ matrix.platform }} + build-args: | + TARGETARCH=${{ contains(matrix.platform, 'arm64') && 'arm64' || 'amd64' }} complete: name: "Complete" diff --git a/docker/runtime/Dockerfile b/docker/runtime/Dockerfile index 06c322b..3557c02 100644 --- a/docker/runtime/Dockerfile +++ b/docker/runtime/Dockerfile @@ -1,11 +1,9 @@ # syntax=docker/dockerfile:1.10.0 -ARG TARGETARCH - # ============================================================================ # AMD64 Builder - Uses cross-tools musl toolchain # ============================================================================ -FROM rust:1.88.0 AS builder-amd64 +FROM --platform=linux/amd64 rust:1.88.0 AS builder-amd64 ENV DEBIAN_FRONTEND=noninteractive @@ -70,7 +68,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ # ============================================================================ # ARM64 Builder - Uses Alpine with native musl # ============================================================================ -FROM rust:1.88-alpine AS builder-arm64 +FROM --platform=linux/arm64 rust:1.88-alpine AS builder-arm64 RUN apk add --no-cache \ musl-dev \ @@ -101,6 +99,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ # ============================================================================ # Select the appropriate builder based on target architecture # ============================================================================ +ARG TARGETARCH FROM builder-${TARGETARCH} AS builder # Runtime stage - minimal image