From eae915d95e66c516f222279c81a938a24893f3e0 Mon Sep 17 00:00:00 2001 From: nicolasgere Date: Thu, 29 Feb 2024 13:12:28 -0800 Subject: [PATCH] [ENH]: make rust docker image build faster with cache (#1730) ## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Use docker cache for faster tilt restart. ## Test plan *How are these changes tested?* - With tilt Co-authored-by: nicolas --- rust/worker/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust/worker/Dockerfile b/rust/worker/Dockerfile index 2e3802787e1..ae9ce8f32df 100644 --- a/rust/worker/Dockerfile +++ b/rust/worker/Dockerfile @@ -6,7 +6,6 @@ WORKDIR / RUN git clone https://github.com/chroma-core/hnswlib.git WORKDIR /chroma/ -COPY . . ENV PROTOC_ZIP=protoc-25.1-linux-x86_64.zip RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/$PROTOC_ZIP \ @@ -14,7 +13,9 @@ RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v25.1 && unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \ && rm -f $PROTOC_ZIP -RUN cargo build +COPY . . + +RUN --mount=type=cache,target=/root/.cache/cargo CARGO_TARGET_DIR=/root/.cache/cargo cargo build WORKDIR /chroma/rust/worker