-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rust worker now rebuilds in ~53s on my machine
- Loading branch information
Showing
2 changed files
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.dockerignore | ||
.gitignore | ||
Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,34 @@ | ||
FROM rust:1.74.1 as builder | ||
ARG CHROMA_KUBERNETES_INTEGRATION=0 | ||
ARG RELEASE_MODE=0 | ||
ENV CHROMA_KUBERNETES_INTEGRATION $CHROMA_KUBERNETES_INTEGRATION | ||
|
||
ARG RELEASE_MODE= | ||
|
||
WORKDIR / | ||
RUN git clone https://github.com/chroma-core/hnswlib.git | ||
|
||
# Cache dependencies by building them without our code first. | ||
# https://dev.to/rogertorres/first-steps-with-docker-rust-30oi | ||
# https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/ | ||
WORKDIR /chroma/ | ||
COPY . . | ||
|
||
COPY Cargo.toml Cargo.toml | ||
COPY Cargo.lock CARGO.lock | ||
COPY idl/ idl/ | ||
COPY /rust/worker/Cargo.toml rust/worker/Cargo.toml | ||
ENV PROTOC_ZIP=protoc-25.1-linux-x86_64.zip | ||
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/$PROTOC_ZIP \ | ||
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \ | ||
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \ | ||
&& rm -f $PROTOC_ZIP | ||
# We need to replace the query node's real main() with a dummy at the expected location. | ||
RUN mkdir -p rust/worker/src/bin/ && echo "fn main() {}" > rust/worker/src/bin/query_service.rs | ||
|
||
RUN if [ "$RELEASE_MODE" = "1" ]; then cargo build --release; else cargo build; fi | ||
RUN rm -f rust/worker/src/bin/query_service.rs | ||
|
||
COPY rust/ rust/ | ||
RUN touch rust/worker/src/bin/query_service.rs | ||
RUN if [ "$RELEASE_MODE" = "1" ]; then cargo install --path rust/worker; else cargo install --debug --path rust/worker; fi | ||
COPY rust/worker/chroma_config.yaml . | ||
|
||
CMD ["./target/release/query_service"] | ||
CMD ["query_service"] |