-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Dockerfile
67 lines (52 loc) · 2.11 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
FROM python:3.11-slim-bookworm AS builder
ARG REBUILD_HNSWLIB
ARG PROTOBUF_VERSION=28.2
RUN apt-get update --fix-missing && apt-get install -y --fix-missing \
build-essential \
gcc \
g++ \
cmake \
autoconf \
python3-dev \
unzip \
curl \
make && \
rm -rf /var/lib/apt/lists/* && \
mkdir /install
# Install specific Protobuf compiler (v28.2)
RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d /usr/local/ && \
rm protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
chmod +x /usr/local/bin/protoc && \
protoc --version # Verify installed version
WORKDIR /install
COPY ./requirements.txt requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip pip install --upgrade --prefix="/install" -r requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip if [ "$REBUILD_HNSWLIB" = "true" ]; then pip install --no-binary :all: --force-reinstall --prefix="/install" chroma-hnswlib; fi
# Install gRPC tools for Python with fixed version
RUN pip install grpcio==1.58.0 grpcio-tools==1.58.0
# Copy source files to build Protobufs
COPY ./ /chroma
# Generate Protobufs
WORKDIR /chroma
RUN make -C idl proto_python
FROM python:3.11-slim-bookworm AS final
# Create working directory
RUN mkdir /chroma
WORKDIR /chroma
# Copy entrypoint
COPY ./bin/docker_entrypoint.sh /docker_entrypoint.sh
RUN apt-get update --fix-missing && apt-get install -y curl && \
chmod +x /docker_entrypoint.sh && \
rm -rf /var/lib/apt/lists/*
# Copy built dependencies and generated Protobufs
COPY --from=builder /install /usr/local
COPY --from=builder /chroma /chroma
ENV CHROMA_HOST_ADDR="0.0.0.0"
ENV CHROMA_HOST_PORT=8000
ENV CHROMA_WORKERS=1
ENV CHROMA_LOG_CONFIG="chromadb/log_config.yml"
ENV CHROMA_TIMEOUT_KEEP_ALIVE=30
EXPOSE 8000
ENTRYPOINT ["/docker_entrypoint.sh"]
CMD [ "--workers ${CHROMA_WORKERS} --host ${CHROMA_HOST_ADDR} --port ${CHROMA_HOST_PORT} --proxy-headers --log-config ${CHROMA_LOG_CONFIG} --timeout-keep-alive ${CHROMA_TIMEOUT_KEEP_ALIVE}"]