From ee7195d7b58c438f9b331d01ee295c19e3f376d2 Mon Sep 17 00:00:00 2001 From: Alexander Zayats Date: Fri, 13 Feb 2026 15:59:20 +0000 Subject: [PATCH 1/2] Add Dockerfile for ARM64 architecture support and update README instructions --- Dockerfile-arm64 | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 Dockerfile-arm64 diff --git a/Dockerfile-arm64 b/Dockerfile-arm64 new file mode 100644 index 000000000..ecaa91430 --- /dev/null +++ b/Dockerfile-arm64 @@ -0,0 +1,87 @@ +FROM lukemathwalker/cargo-chef:latest-rust-1.92-bookworm AS chef +WORKDIR /usr/src + +ENV SCCACHE=0.10.0 +ENV RUSTC_WRAPPER=/usr/local/bin/sccache + +# Download and configure ARM64-compatible sccache +RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v$SCCACHE/sccache-v$SCCACHE-aarch64-unknown-linux-musl.tar.gz | tar -xzv --strip-components=1 -C /usr/local/bin sccache-v$SCCACHE-aarch64-unknown-linux-musl/sccache && \ + chmod +x /usr/local/bin/sccacheExpand commentComment on line R9Resolved + +FROM chef AS planner + +COPY backends backends +COPY core core +COPY router router +COPY Cargo.toml ./ +COPY Cargo.lock ./ + +RUN cargo chef prepare --recipe-path recipe.json + +FROM chef AS builder + +ARG GIT_SHA +ARG DOCKER_LABEL + +# sccache specific variables +ARG SCCACHE_GHA_ENABLED + +COPY --from=planner /usr/src/recipe.json recipe.json + +RUN --mount=type=secret,id=actions_results_url,env=ACTIONS_RESULTS_URL \ + --mount=type=secret,id=actions_runtime_token,env=ACTIONS_RUNTIME_TOKEN \ + cargo chef cook --release --features ort,candle,static-linking --no-default-features --recipe-path recipe.json && sccache -s + +COPY backends backends +COPY core core +COPY router router +COPY Cargo.toml ./ +COPY Cargo.lock ./ + +FROM builder AS http-builder + +RUN --mount=type=secret,id=actions_results_url,env=ACTIONS_RESULTS_URL \ + --mount=type=secret,id=actions_runtime_token,env=ACTIONS_RUNTIME_TOKEN \ + cargo build --release --bin text-embeddings-router --features ort,candle,static-linking,http --no-default-features && sccache -s + +FROM builder AS grpc-builder + +RUN PROTOC_ZIP=protoc-21.12-linux-aarch_64.zip && \ + curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \ + unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \ + unzip -o $PROTOC_ZIP -d /usr/local 'include/*' && \ + rm -f $PROTOC_ZIPExpand commentComment on line R53Resolved + +COPY proto proto + +RUN --mount=type=secret,id=actions_results_url,env=ACTIONS_RESULTS_URL \ + --mount=type=secret,id=actions_runtime_token,env=ACTIONS_RUNTIME_TOKEN \ + cargo build --release --bin text-embeddings-router --features ort,candle,static-linking,grpc --no-default-features && sccache -s + +FROM debian:bookworm-slim AS base + +ENV HUGGINGFACE_HUB_CACHE=/data \ + PORT=80 \ + RAYON_NUM_THREADS=8 \ + LD_LIBRARY_PATH=/usr/local/lib + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + libomp-dev \ + ca-certificates \ + libssl-dev \ + curl \ + && rm -rf /var/lib/apt/lists/* + +FROM base AS grpc + +COPY --from=grpc-builder /usr/src/target/release/text-embeddings-router /usr/local/bin/text-embeddings-router + +ENTRYPOINT ["text-embeddings-router"] +CMD ["--json-output"] + +FROM base AS http + +COPY --from=http-builder /usr/src/target/release/text-embeddings-router /usr/local/bin/text-embeddings-router + +ENTRYPOINT ["text-embeddings-router"] +CMD ["--json-output"] diff --git a/README.md b/README.md index 238a0c958..7972cfa01 100644 --- a/README.md +++ b/README.md @@ -604,7 +604,7 @@ supported via Docker. As such inference will be CPU bound and most likely pretty M1/M2 ARM CPU. ``` -docker build . -f Dockerfile --platform=linux/arm64 +docker build . -f Dockerfile-arm64 --platform=linux/arm64 ``` ## Examples From e923d8eb3ef35c9e670eb4835c2534a9dc9c967c Mon Sep 17 00:00:00 2001 From: Alexander Zayats Date: Fri, 13 Feb 2026 16:05:15 +0000 Subject: [PATCH 2/2] Cleanup --- Dockerfile-arm64 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile-arm64 b/Dockerfile-arm64 index ecaa91430..d2f74b034 100644 --- a/Dockerfile-arm64 +++ b/Dockerfile-arm64 @@ -6,7 +6,7 @@ ENV RUSTC_WRAPPER=/usr/local/bin/sccache # Download and configure ARM64-compatible sccache RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v$SCCACHE/sccache-v$SCCACHE-aarch64-unknown-linux-musl.tar.gz | tar -xzv --strip-components=1 -C /usr/local/bin sccache-v$SCCACHE-aarch64-unknown-linux-musl/sccache && \ - chmod +x /usr/local/bin/sccacheExpand commentComment on line R9Resolved + chmod +x /usr/local/bin/sccache FROM chef AS planner @@ -50,7 +50,7 @@ RUN PROTOC_ZIP=protoc-21.12-linux-aarch_64.zip && \ curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP && \ unzip -o $PROTOC_ZIP -d /usr/local bin/protoc && \ unzip -o $PROTOC_ZIP -d /usr/local 'include/*' && \ - rm -f $PROTOC_ZIPExpand commentComment on line R53Resolved + rm -f $PROTOC_ZIP COPY proto proto