| # Use the official Ollama image as base — avoids all install/PATH issues | |
| FROM ollama/ollama:latest | |
| # ── System deps for Python ──────────────────────────────────────────────────── | |
| RUN apt-get update && apt-get install -y \ | |
| python3 \ | |
| python3-pip \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ── Python API layer ────────────────────────────────────────────────────────── | |
| WORKDIR /app | |
| COPY requirements.txt . | |
| RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt | |
| COPY app.py . | |
| COPY entrypoint.sh . | |
| RUN chmod +x entrypoint.sh | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| ENV OLLAMA_HOST=0.0.0.0:11434 | |
| ENV OLLAMA_MODELS=/app/models | |
| ENV MODEL_TAG=gemma4:12b-it-qat | |
| ENV OLLAMA_FLASH_ATTENTION=1 | |
| ENTRYPOINT ["/app/entrypoint.sh"] |