# syntax=docker/dockerfile:1 FROM python:3.12-slim ENV DEBIAN_FRONTEND=noninteractive # Build & runtime deps for llama-cpp-python (CPU, OpenBLAS) RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential cmake git curl ca-certificates \ libopenblas-dev && \ rm -rf /var/lib/apt/lists/* # Writable home and cache locations ENV HOME=/app \ HF_HOME=/app/hf_cache \ HF_HUB_CACHE=/app/hf_cache \ XDG_CACHE_HOME=/app/.cache RUN mkdir -p /app /app/hf_cache /app/.cache && chmod -R 777 /app # Workdir WORKDIR /app # Python deps COPY requirements.txt /app/requirements.txt RUN pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt && \ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" \ pip install --no-cache-dir llama-cpp-python==0.2.90 # App COPY app.py /app/app.py COPY README.md /app/README.md # Gradio port EXPOSE 7860 ENV GRADIO_SERVER_NAME=0.0.0.0 \ GRADIO_SERVER_PORT=7860 CMD ["python", "app.py"]