diff --git a/Dockerfile b/Dockerfile index 489a6a961bd..1f90733edbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,22 @@ -FROM python:3.10-slim-bookworm as builder - +FROM python:3.11-slim-bookworm AS builder +ARG REBUILD_HNSWLIB RUN apt-get update --fix-missing && apt-get install -y --fix-missing \ build-essential \ gcc \ - g++ && \ - rm -rf /var/lib/apt/lists/* + g++ \ + cmake \ + autoconf && \ + rm -rf /var/lib/apt/lists/* && \ + mkdir /install -RUN mkdir /install WORKDIR /install COPY ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade --prefix="/install" -r requirements.txt +RUN if [ "$REBUILD_HNSWLIB" = "true" ]; then pip install --no-binary :all: --force-reinstall --no-cache-dir --prefix="/install" chroma-hnswlib; fi -FROM python:3.10-slim-bookworm as final - -RUN apt-get update --fix-missing && apt-get install -y --fix-missing \ - build-essential \ - gcc \ - g++ && \ - rm -rf /var/lib/apt/lists/* +FROM python:3.11-slim-bookworm AS final RUN mkdir /chroma WORKDIR /chroma diff --git a/bin/docker_entrypoint.sh b/bin/docker_entrypoint.sh index b1336b8d455..f1597a0664c 100755 --- a/bin/docker_entrypoint.sh +++ b/bin/docker_entrypoint.sh @@ -1,7 +1,5 @@ #!/bin/bash -echo "Rebuilding hnsw to ensure architecture compatibility" -pip install --force-reinstall --no-cache-dir chroma-hnswlib export IS_PERSISTENT=1 export CHROMA_SERVER_NOFILE=65535 uvicorn chromadb.app:app --workers 1 --host 0.0.0.0 --port 8000 --proxy-headers --log-config chromadb/log_config.yml --timeout-keep-alive 30 diff --git a/examples/advanced/hadrware-optimized-image.md b/examples/advanced/hadrware-optimized-image.md new file mode 100644 index 00000000000..41aad017719 --- /dev/null +++ b/examples/advanced/hadrware-optimized-image.md @@ -0,0 +1,10 @@ +# Building Hardware Optimized ChromaDB Image + +The default Chroma DB image comes with binary distribution of hnsw lib which is not optimized to take advantage of +certain CPU architectures (Intel-based) with AVX support. This can be improved by building an image with hnsw rebuilt +from source. To do that run: + +```bash +docker build -t chroma-test1 --build-arg REBUILD_HNSWLIB=true --no-cache . +``` +