Yulya / Dockerfile
moheith's picture
Upload Dockerfile
69aaa13 verified
Raw History Blame Contribute Delete
956 Bytes
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"]