Spaces:
Sleeping
Sleeping
File size: 1,263 Bytes
7fdb8e9 0095b5b fa00806 0095b5b 7475792 0095b5b 99c60dd 7fdb8e9 99c60dd 7fdb8e9 dd14df2 7fdb8e9 99c60dd e3163e4 7fdb8e9 |
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 |
# Use Python 3.10 as base image
FROM python:3.10-slim
# Install system dependencies and uv
RUN apt-get update && apt-get install -y \
poppler-utils \
curl \
&& rm -rf /var/lib/apt/lists/* \
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
&& echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc \
&& . ~/.bashrc
# Copy requirements first to leverage Docker cache
COPY pyproject.toml .
# Install Python dependencies using uv
RUN . ~/.bashrc && uv pip install -r pyproject.toml --system && uv pip install llama-index-readers-file --system
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
# Create directories for uploads and embeddings if they don't exist
RUN mkdir -p uploads embeddings
# Expose the port the app runs on
EXPOSE 7860
# Change to rag_demo directory and run the app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |