| # SysCRED Docker Configuration for Hugging Face Spaces | |
| # LIGHT version (sans ML local) - Optimized for Render 512MB | |
| FROM python:3.10-slim | |
| WORKDIR /app | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PYTHONPATH=/app | |
| ENV SYSCRED_LOAD_ML_MODELS=false | |
| ENV SYSCRED_ENV=production | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy LIGHT requirements (sans ML local pour Render 512MB) | |
| COPY requirements-light.txt /app/requirements-light.txt | |
| # Install dependencies (sans PyTorch, Transformers, spaCy) | |
| RUN pip install --no-cache-dir -r requirements-light.txt | |
| # NOTE: spaCy models NOT downloaded (requirements-light doesn't include spaCy) | |
| # RUN python -m spacy download en_core_web_md || true | |
| # RUN python -m spacy download fr_core_news_md || true | |
| # Copy application code | |
| COPY syscred/ /app/syscred/ | |
| COPY ontology/ /app/ontology/ | |
| # NOTE: .env is NOT copied - HF Space uses Secrets instead | |
| # Make ontology directory writable (fix Permission denied for TTL export) | |
| RUN chmod -R 777 /app/ontology | |
| # Create user for HF Spaces (required) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user | |
| ENV PATH=/home/user/.local/bin:$PATH | |
| # Make ontology directory writable for GraphRAG persistence | |
| RUN chmod -R 777 /app/ontology || true | |
| WORKDIR /app | |
| # HF Spaces uses port 7860 | |
| EXPOSE 7860 | |
| # Run with HF Spaces port | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "300", "syscred.backend_app:app"] | |