chroma / Dockerfile
gcharanteja
dd
6b75c6d
Raw
History Blame Contribute Delete
868 Bytes
FROM python:3.10-slim
# 1. Create user 'user' with UID 1000
RUN useradd -m -u 1000 user
# 2. Set environment variables
ENV PATH="/home/user/.local/bin:$PATH"
ENV CHROMA_SERVER_HOST=0.0.0.0
ENV CHROMA_SERVER_HTTP_PORT=7860
# 3. Set working directory
WORKDIR /app
# 4. Copy requirements and install
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# 5. Copy application code
COPY --chown=user . /app
# 6. Ensure /app is writable by user (for logs)
RUN chown -R user:user /app
# 7. Switch to non-root user
USER user
# 8. Expose port
EXPOSE 7860
# 9. Start ChromaDB
# We use a shell command to:
# 1. Create /data/chroma_db if it doesn't exist (at runtime)
# 2. Start chroma pointing to it
CMD ["sh", "-c", "mkdir -p /data/chroma_db && chroma run --path /data/chroma_db --host 0.0.0.0 --port 7860"]