File size: 899 Bytes
48c7fed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# System deps needed by pypdf, python-docx, torch
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Install Python dependencies (cached as a separate layer)
COPY backend/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Copy source
COPY backend/ ./backend/
COPY frontend/ ./frontend/

# Runtime directories
RUN mkdir -p uploads results .cache

# HF Spaces requires port 7860 and runs containers as uid 1000
RUN useradd -m -u 1000 user && chown -R user:user /app
USER user

# PYTHONPATH=/app lets `from backend.X import ...` resolve correctly
ENV PORT=7860 \
    HOST=0.0.0.0 \
    DEBUG=False \
    PYTHONPATH=/app \
    HF_HOME=/app/.cache/huggingface \
    MODEL_CACHE_DIR=/app/.cache/models

EXPOSE 7860

CMD ["python", "backend/main.py"]