Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions docker/Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Cross-build parakeet.cpp for arm64 (aarch64) via docker buildx + qemu.
#
# docker buildx build --platform linux/arm64 -f docker/Dockerfile.arm64 \
# --target export --output type=local,dest=build/arm64 .
#
# The build runs under qemu user emulation (slow but reproducible). The base is
# ubuntu:24.04 so the toolchain (gcc 13.3, glibc 2.39) and resulting ABI match a
# Raspberry Pi 5 running Ubuntu 24.04 -- the binary drops straight onto the Pi
# (it links only the system libc/libstdc++/libgomp; ggml and libparakeet are
# static).
#
# By default it targets the Pi 5's Cortex-A76 (armv8.2-a + dotprod + fp16), which
# is what ggml's quantized kernels exploit. Override --build-arg GGML_CPU_ARM_ARCH
# for a different chip, or set it to a baseline like "armv8-a" for a portable
# (slower) binary.
#
# The build context must be a checkout with the ggml submodule populated
# (git submodule update --init --recursive third_party/ggml).
ARG UBUNTU=24.04

FROM ubuntu:${UBUNTU} AS build
ARG GGML_CPU_ARM_ARCH=armv8.2-a+dotprod+fp16
ARG JOBS=8
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY . .
# The build context drops .git (see .dockerignore), so the ggml submodule's
# .git gitlink dangles and CMake's scripts/apply_ggml_patches.sh (which uses
# `git apply`) can't run. Re-init a throwaway git repo in the submodule tree so
# the in-tree ggml patches (broadcast-fold sgemm, etc.) apply during configure.
RUN rm -f third_party/ggml/.git && git -C third_party/ggml init -q
# Static, self-contained CLI: BUILD_SHARED_LIBS=OFF keeps ggml + libparakeet in
# the binary; GGML_NATIVE=OFF + GGML_CPU_ARM_ARCH targets the Pi's Cortex-A76
# instead of the (x86) build host. Skip the server + tests to keep the qemu
# build lean -- we only need parakeet-cli for the benchmark.
RUN cmake -S . -B build/arm64 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DGGML_NATIVE=OFF \
-DGGML_CPU_ARM_ARCH=${GGML_CPU_ARM_ARCH} \
-DPARAKEET_BUILD_CLI=ON \
-DPARAKEET_BUILD_SERVER=OFF \
-DPARAKEET_BUILD_TESTS=OFF \
&& cmake --build build/arm64 -j${JOBS} --target parakeet-cli

# Thin export stage: `--output type=local` against this target writes just the
# binary to the host (no image layers, no apt cruft).
FROM scratch AS export
COPY --from=build /src/build/arm64/examples/cli/parakeet-cli /
Loading