-
Notifications
You must be signed in to change notification settings - Fork 363
Add Dockerfile for ARM64 architecture support and update README instructions #827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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/sccache | ||
|
|
||
| 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_ZIP | ||
|
|
||
| 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"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI/CD workflow files (.github/workflows/build.yaml and .github/workflows/test.yaml) currently trigger on changes to "Dockerfile" but not "Dockerfile-arm64". This means that changes to the new ARM64 Dockerfile won't trigger automated builds or tests. Consider updating the workflow paths to include "Dockerfile-arm64" to ensure proper CI/CD coverage for ARM64 builds.