FROM python:3.10-slim
# Set up a new user to avoid running as root
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory
WORKDIR $HOME/app
# Copy the requirements and install them
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy all the app files (including the .gguf model)
COPY --chown=user . .
# Hugging Face Spaces exposes port 7860
EXPOSE 7860
# Run Chainlit on port 7860
CMD ["chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860", "--headless"]