Skip to content

Commit 5e7f70e

Browse files
authored
[ENH]: publish image with Rust CLI, update sample configs (#3843)
## Description of changes - The Rust CLI is now published in our container image instead of the Python server. - Removed Python from frontend/CLI & worker Dockerfiles. - Put all sample configs under `rust/frontend/sample_configs`. ## Test plan *How are these changes tested?* Built the new image with ``` docker build -f rust/cli/Dockerfile -t rust-chromadb . ``` and verified that it exposes a working API.
1 parent 6a731b6 commit 5e7f70e

File tree

12 files changed

+66
-57
lines changed

12 files changed

+66
-57
lines changed

.github/workflows/release-chromadb.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,23 @@ jobs:
9898
uses: depot/build-push-action@v1
9999
with:
100100
context: .
101+
file: rust/cli/Dockerfile
101102
platforms: ${{ env.PLATFORMS }}
102103
push: true
104+
build-args: |
105+
RELEASE_MODE=1
103106
tags: "${{ env.GHCR_IMAGE_NAME }}:${{ needs.get-version.outputs.version}},${{ env.DOCKERHUB_IMAGE_NAME }}:${{ needs.get-version.outputs.version }}"
104107
project: ${{ vars.DEPOT_PROJECT_ID }}
105108
- name: Build and push release Docker image
106109
if: ${{ needs.check-tag.outputs.tag_matches == 'true' }}
107110
uses: depot/build-push-action@v1
108111
with:
109112
context: .
113+
file: rust/cli/Dockerfile
110114
platforms: ${{ env.PLATFORMS }}
111115
push: true
116+
build-args: |
117+
RELEASE_MODE=1
112118
tags: "${{ env.GHCR_IMAGE_NAME }}:${{ needs.get-version.outputs.version }},${{ env.DOCKERHUB_IMAGE_NAME }}:${{ needs.get-version.outputs.version }},${{ env.GHCR_IMAGE_NAME }}:latest,${{ env.DOCKERHUB_IMAGE_NAME }}:latest"
113119
project: ${{ vars.DEPOT_PROJECT_ID }}
114120

@@ -198,7 +204,7 @@ jobs:
198204
PIP Package: `chroma-${{needs.get-version.outputs.version}}.tar.gz`
199205
Github Container Registry Image: `${{ env.GHCR_IMAGE_NAME }}:${{ needs.get-version.outputs.version }}`
200206
DockerHub Image: `${{ env.DOCKERHUB_IMAGE_NAME }}:${{ needs.get-version.outputs.version }}`
201-
artifacts: "dist/chromadb-${{needs.get-version.outputs.version}}.tar.gz"
207+
artifacts: "dist/*"
202208
prerelease: false
203209
makeLatest: true
204210
generateReleaseNotes: true
@@ -222,7 +228,7 @@ jobs:
222228
PIP Package: `chroma-${{needs.get-version.outputs.version}}.tar.gz`
223229
Github Container Registry Image: `${{ env.GHCR_IMAGE_NAME }}:${{ needs.get-version.outputs.version }}`
224230
DockerHub Image: `${{ env.DOCKERHUB_IMAGE_NAME }}:${{ needs.get-version.outputs.version }}`
225-
artifacts: "dist/chromadb-${{needs.get-version.outputs.version}}.tar.gz"
231+
artifacts: "dist/*"
226232
allowUpdates: true
227233
removeArtifacts: true
228234
prerelease: true

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pyo3 = { version = "0.23.3", features = ["abi3-py39"] }
4848
tower-http = { version = "0.6.2", features = ["trace"] }
4949
bytemuck = "1.21.0"
5050
validator = { version = "0.19", features = ["derive"] }
51-
rust-embed = { version = "8.5.0", features = ["include-exclude"] }
51+
rust-embed = { version = "8.5.0", features = ["include-exclude", "debug-embed"] }
5252
hnswlib = { version = "0.8.0", git = "https://github.com/chroma-core/hnswlib.git" }
5353

5454
chroma-benchmark = { path = "rust/benchmark" }

Tiltfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ docker_build(
5050
'local:rust-frontend-service',
5151
'.',
5252
only=["rust/", "idl/", "Cargo.toml", "Cargo.lock"],
53-
dockerfile='./rust/frontend/Dockerfile',
54-
target='frontend_service'
53+
dockerfile='./rust/cli/Dockerfile',
5554
)
5655

5756

k8s/distributed-chroma/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apiVersion: v2
1616
name: distributed-chroma
1717
description: A helm chart for distributed Chroma
1818
type: application
19-
version: 0.1.18
19+
version: 0.1.19
2020
appVersion: "0.4.24"
2121
keywords:
2222
- chroma

k8s/distributed-chroma/templates/rust-frontend-service.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ spec:
1515
spec:
1616
containers:
1717
- name: rust-frontend-service
18+
command: ["chroma", "run", "$(CONFIG_PATH)"]
1819
image: "{{ .Values.rustFrontendService.image.repository }}:{{ .Values.rustFrontendService.image.tag }}"
1920
imagePullPolicy: IfNotPresent
2021
readinessProbe:
@@ -32,10 +33,16 @@ spec:
3233
cpu: {{ .Values.rustFrontendService.resources.requests.cpu }}
3334
memory: {{ .Values.rustFrontendService.resources.requests.memory }}
3435
{{ end }}
35-
{{ if .Values.frontendService.otherEnvConfig }}
3636
env:
37-
{{ .Values.frontendService.otherEnvConfig | nindent 12 }}
38-
{{ end }}
37+
- name: CONFIG_PATH
38+
value: "/sample_configs/distributed.yaml"
39+
{{ if .Values.frontendService.otherEnvConfig }}
40+
{{ .Values.frontendService.otherEnvConfig | nindent 12 }}
41+
{{ end }}
42+
{{ if .Values.rustFrontendService.otherEnvConfig }}
43+
{{ .Values.rustFrontendService.otherEnvConfig | nindent 12 }}
44+
{{ end }}
45+
3946
{{if .Values.rustFrontendService.tolerations}}
4047
tolerations:
4148
{{ toYaml .Values.rustFrontendService.tolerations | nindent 8 }}

rust/cli/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM rust:1.81.0-alpine AS builder
2+
3+
ARG RELEASE_MODE=
4+
5+
WORKDIR /chroma
6+
7+
ENV PROTOC_ZIP=protoc-25.1-linux-x86_64.zip
8+
RUN apk add curl musl-dev alpine-sdk \
9+
&& curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/$PROTOC_ZIP \
10+
&& unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
11+
&& unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
12+
&& rm -f $PROTOC_ZIP
13+
14+
COPY idl/ idl/
15+
COPY Cargo.toml Cargo.toml
16+
COPY Cargo.lock Cargo.lock
17+
COPY rust/ rust/
18+
19+
# sharing=locked is necessary to prevent cargo build from running concurrently on the same mounted directory
20+
RUN --mount=type=cache,sharing=locked,target=/chroma/target/ \
21+
--mount=type=cache,sharing=locked,target=/usr/local/cargo/registry/ \
22+
cd rust/cli && \
23+
if [ "$RELEASE_MODE" = "1" ]; then cargo build --bin chroma --release; else cargo build --bin chroma; fi && \
24+
cd ../.. && \
25+
if [ "$RELEASE_MODE" = "1" ]; then mv target/release/chroma ./chroma; else mv target/debug/chroma ./chroma; fi
26+
27+
28+
FROM scratch AS runner
29+
30+
COPY --from=builder /chroma/rust/frontend/sample_configs /sample_configs
31+
COPY --from=builder /chroma/rust/frontend/sample_configs/docker_single_node.yaml /config.yaml
32+
COPY --from=builder /chroma/chroma /usr/local/bin/chroma
33+
34+
EXPOSE 8000
35+
36+
ENTRYPOINT [ "chroma" ]
37+
CMD [ "run", "/config.yaml" ]

rust/frontend/Dockerfile

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
persist_path: "/data"

0 commit comments

Comments
 (0)