File size: 956 Bytes
0ff1b27 6b20080 0ff1b27 6b20080 b0c9390 69aaa13 45b692f 6b20080 0ff1b27 6b20080 0ff1b27 6b20080 5faadf4 | 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 | FROM python:3.10-slim
WORKDIR /code
# Install the C++ Compiler required for llama-cpp-python
RUN apt-get update && apt-get install -y build-essential python3-dev
# Force install the specific libraries globally as Root
# CRITICAL FIX: Use the pre-built CPU wheel so it installs instantly instead of compiling for 30 minutes
RUN pip install --no-cache-dir --prefer-binary "pydantic<2.9" "chainlit==1.1.400"
RUN pip install --no-cache-dir --prefer-binary llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
# Set up the Hugging Face restricted user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy all the app files (including the .gguf model)
COPY --chown=user . $HOME/app
# Hugging Face Spaces exposes port 7860
EXPOSE 7860
# Run Chainlit
CMD ["python", "-m", "chainlit", "run", "app.py", "--host", "0.0.0.0", "--port", "7860", "--headless"]
|