Files
buzz/Dockerfile.sprig
Salman Mohammed 66095e5598 fix: inline ARM64 atomics in Sprig image build (#9291)
## Summary

Sprig's ARM64 container fails to link because bundled D-Bus emits a call
to GCC's `__aarch64_ldadd4_sync` helper, which Rust's static musl link
does not supply. AMD64 succeeds, but the failed ARM64 job blocks
publication of the multi-architecture image.

Set the ARM64 musl C compiler flags to `-mno-outline-atomics` in the
image builder. This emits baseline ARM64 atomic instructions inline
instead of requiring the missing helper. Other targets and the runtime
image configuration are unchanged.

### Related issue

No duplicate fix found. [Failing
build](https://github.com/block/buzz/actions/runs/42667527024/job/129335071943).
The [previous main
build](https://github.com/block/buzz/actions/runs/42642040718) has the
same failure, before the MCP dependency update.

### Testing

The exact local ARM64 image build passed: `docker build --platform
linux/arm64 --file Dockerfile.sprig --tag buzz-sprig:arm64-link-fix .`.
The resulting `sprig --version` command passed. The `buzz-agent`
personality reached its expected missing-provider configuration error.
Broad local checks were not run.

Generated with Codex

Signed-off-by: Salman Mohammed <smohammed@squareup.com>
2026-11-09 15:38:41 -05:00

45 lines
1.6 KiB
Docker

# syntax=docker/dockerfile:1.7
# Multi-arch is produced by building this file on native amd64 and arm64 runners.
# Keep both bases pinned to manifest-list digests so either architecture resolves
# to immutable source bytes.
FROM rust:1.98-alpine3.22@sha256:a1796ca6fa216d6727b5f61c69e4c665b120b1a4dcb969639e2f25f1ed309456 AS builder
RUN apk add --no-cache \
build-base \
cmake \
git \
musl-dev \
openssl-dev \
openssl-libs-static \
perl \
pkgconf \
protoc
WORKDIR /build
COPY . .
# GCC's outlined ARM64 atomics require libgcc helpers that Rust's static musl
# link does not provide (notably __aarch64_ldadd4_sync in vendored D-Bus).
# Emit baseline ARM64 atomics inline; cc-rs applies this only to that target.
ENV CFLAGS_aarch64_unknown_linux_musl="-mno-outline-atomics"
RUN cargo build --locked --profile sprig -p sprig \
&& strip target/sprig/sprig
FROM alpine:3.22@sha256:14358309a308569c32bdc37e2e0e9694be33a9d99e68afb0f5ff33cc1f695dce
RUN apk add --no-cache bash ca-certificates curl git \
&& adduser -D -h /home/agent agent \
&& install -d -o agent -g agent /workspace /home/agent
COPY --from=builder --chmod=0755 /build/target/sprig/sprig /usr/local/bin/sprig
COPY --chmod=0755 scripts/sprig-entrypoint.sh /usr/local/bin/sprig-entrypoint
RUN for name in \
buzz-acp buzz-agent buzz-dev-mcp rg tree buzz \
git-credential-nostr git-sign-nostr; do \
ln -s sprig "/usr/local/bin/$name"; \
done
ENV HOME=/home/agent \
PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin
WORKDIR /home/agent
USER agent
ENTRYPOINT ["/usr/local/bin/sprig-entrypoint"]