ci: use pre-built binaries for Docker instead of QEMU cross-compilation

QEMU arm64 Rust builds took 60+ min and timed out in CI. Now the Docker
job downloads the pre-built release binaries and packages them directly.

- Dockerfile.ci: slim image for CI (downloads pre-built binaries)
- Dockerfile: full source build for local dev (unchanged build stage)
- Both use ubuntu:24.04 (GLIBC 2.39 matches CI build environment)
- Multi-arch manifest combines amd64 + arm64 images

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Valerio 2026-03-27 20:32:50 +01:00
parent dfcddd1973
commit 48a3c45b36
3 changed files with 68 additions and 11 deletions

View file

@ -99,11 +99,16 @@ jobs:
name: Docker name: Docker
needs: release needs: release
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
include:
- platform: linux/amd64
binary_target: x86_64-unknown-linux-gnu
- platform: linux/arm64
binary_target: aarch64-unknown-linux-gnu
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3 - uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3 - uses: docker/login-action@v3
@ -112,16 +117,53 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6 # Download pre-built binaries from the release instead of recompiling
- name: Download release binaries
run: |
tag="${GITHUB_REF#refs/tags/}"
tarball="webclaw-${tag}-${{ matrix.binary_target }}.tar.gz"
curl -sSL "https://github.com/0xMassi/webclaw/releases/download/${tag}/${tarball}" -o release.tar.gz
tar xzf release.tar.gz
mkdir -p binaries
find . -name 'webclaw' -not -name 'webclaw-mcp' -path '*/webclaw-*/' -exec cp {} binaries/webclaw \;
find . -name 'webclaw-mcp' -exec cp {} binaries/webclaw-mcp \;
chmod +x binaries/*
ls -la binaries/
- name: Build and push
uses: docker/build-push-action@v6
with: with:
context: . context: .
file: Dockerfile.ci
push: true push: true
platforms: linux/amd64,linux/arm64 platforms: ${{ matrix.platform }}
tags: | tags: ghcr.io/0xmassi/webclaw:${{ github.ref_name }}-${{ matrix.binary_target }}
ghcr.io/0xmassi/webclaw:latest build-args: |
ghcr.io/0xmassi/webclaw:${{ github.ref_name }} BINARY_DIR=binaries
cache-from: type=gha
cache-to: type=gha,mode=max docker-manifest:
name: Docker Manifest
needs: docker
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create multi-arch manifest
run: |
tag="${GITHUB_REF#refs/tags/}"
docker manifest create ghcr.io/0xmassi/webclaw:${tag} \
ghcr.io/0xmassi/webclaw:${tag}-x86_64-unknown-linux-gnu \
ghcr.io/0xmassi/webclaw:${tag}-aarch64-unknown-linux-gnu
docker manifest push ghcr.io/0xmassi/webclaw:${tag}
docker manifest create ghcr.io/0xmassi/webclaw:latest \
ghcr.io/0xmassi/webclaw:${tag}-x86_64-unknown-linux-gnu \
ghcr.io/0xmassi/webclaw:${tag}-aarch64-unknown-linux-gnu
docker manifest push ghcr.io/0xmassi/webclaw:latest
homebrew: homebrew:
name: Update Homebrew name: Update Homebrew

View file

@ -46,11 +46,10 @@ RUN touch crates/*/src/*.rs \
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Stage 2: Minimal runtime image # Stage 2: Minimal runtime image
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
FROM debian:bookworm-slim FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy both binaries # Copy both binaries

16
Dockerfile.ci Normal file
View file

@ -0,0 +1,16 @@
# Slim runtime image — uses pre-built binaries from the release.
# The full Dockerfile (multi-stage Rust build) is for local development.
# CI uses this to avoid 60+ min QEMU cross-compilation.
ARG BINARY_DIR=binaries
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
ARG BINARY_DIR
COPY ${BINARY_DIR}/webclaw /usr/local/bin/webclaw
COPY ${BINARY_DIR}/webclaw-mcp /usr/local/bin/webclaw-mcp
CMD ["webclaw"]