m / Dockerfile
sohom004's picture
fixed python path for uv
dbad282 verified
Raw
History Blame Contribute Delete
1.83 kB
FROM qdrant/qdrant:latest
# 1. Install Python runtime dependencies as root
RUN apt-get update && apt-get install -y python3 curl && rm -rf /lib/apt/lists/*
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
RUN bash -c "source ~/.bashrc"
RUN bash -c "source $HOME/.local/bin/env"
RUN whereis uv
ENV PATH="/root/.local/bin:$PATH"
RUN uv --version
# 2. Define the mandatory Hugging Face user (UID 1000)
RUN useradd -m -u 1000 user
RUN mv /root/.local/bin/uv /root/.local/bin/uvx /usr/local/bin/
#COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
WORKDIR /app
# Ensure our app directory belongs completely to the runtime user. Grant our non-root user full ownership of BOTH directories while we are root
RUN chown -R user:user /app
RUN chown -R user:user /app && chown -R user:user /qdrant
# 3. Switch to the non-root user context for all subsequent setups
USER user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH
# 4. Construct the Python Virtual Environment cleanly
#RUN python3 -m venv venv
COPY --chown=user:user requirements.txt /app/requirements.txt
#RUN ./venv/bin/pip install --no-cache-dir -r /app/requirements.txt
RUN uv init
RUN uv add -r /app/requirements.txt
# Copy over your active backend code
COPY --chown=user:user app.py /app/app.py
# Create the bucket target directory
#RUN mkdir -p /data/qdrant_storage # NOT required, since HF can allocate directories dynamically
# 5. Route Engine configurations & Cache pathways # NOTE: /data comes from mounted HF bucket to the current HF space
ENV QDRANT__STORAGE__STORAGE_PATH=/data/qdrant_storage
ENV FASTEMBED_CACHE_PATH=/home/user/.cache/fastembed
EXPOSE 7860
EXPOSE 6333
# 6. Start Qdrant from its native directory in the background, then run FastMCP in the foreground
CMD cd /qdrant && ./qdrant & cd /app && ./.venv/bin/python app.py