Skip to content

Commit

Permalink
k8s commands override docker commands
Browse files Browse the repository at this point in the history
  • Loading branch information
beggers committed Mar 23, 2024
1 parent d66ff6b commit 650c09c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 0 additions & 1 deletion k8s/distributed-chroma/templates/query-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ spec:
- name: query-service
image: "{{ .Values.queryService.image.repository }}:{{ .Values.queryService.image.tag }}"
imagePullPolicy: IfNotPresent
command: ["cargo", "run"]
ports:
- containerPort: 50051
volumeMounts:
Expand Down
21 changes: 14 additions & 7 deletions rust/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ARG CHROMA_KUBERNETES_INTEGRATION=0
ENV CHROMA_KUBERNETES_INTEGRATION $CHROMA_KUBERNETES_INTEGRATION

ARG RELEASE_MODE=
ENV BINARY_LOCATION=${RELEASE_MODE:+target/release/query_service}
ENV BINARY_LOCATION=${BINARY_LOCATION:-target/debug/query_service}

WORKDIR /
RUN git clone https://github.com/chroma-core/hnswlib.git
Expand All @@ -12,23 +14,28 @@ RUN git clone https://github.com/chroma-core/hnswlib.git
# https://www.reddit.com/r/rust/comments/126xeyx/exploring_the_problem_of_faster_cargo_docker/
WORKDIR /chroma/
COPY Cargo.toml Cargo.toml
COPY Cargo.lock CARGO.lock
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
RUN cargo build
RUN rm -rf rust/

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 .
RUN cargo build

FROM debian:bookworm-slim

COPY --from=builder /chroma/target/debug/query_service .
COPY --from=builder /chroma/rust/worker/chroma_config.yaml .
RUN apt-get update && apt-get install -y libssl-dev

CMD ["query_service"]
ENTRYPOINT [ "./query_service" ]

0 comments on commit 650c09c

Please sign in to comment.