File size: 1,536 Bytes
e70050b
ec1c6cb
e70050b
 
 
 
 
 
 
ec1c6cb
89414df
e70050b
 
89414df
e70050b
 
 
ec1c6cb
 
e70050b
ec1c6cb
 
e70050b
ec1c6cb
 
 
3700c55
e70050b
 
89414df
3835e0c
cedf5ef
 
 
e70050b
 
 
 
 
 
 
49f41d0
 
 
e70050b
 
89414df
e70050b
 
89414df
 
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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"]