File size: 915 Bytes
1ad3fb9
3e1a9cb
 
 
 
4c0742d
3e1a9cb
 
 
4c0742d
 
49267ea
3e1a9cb
 
 
 
 
 
669fb06
3e1a9cb
 
9bffb00
1ad3fb9
 
 
3e1a9cb
 
 
 
1ad3fb9
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
# HF Spaces root Dockerfile
FROM python:3.12-slim

WORKDIR /app

# Install system dependencies (psycopg2 needs libpq, Tesseract OCR needs tesseract-ocr)
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    libpq-dev \
    tesseract-ocr \
    tesseract-ocr-eng \
    tesseract-ocr-fra \
    && rm -rf /var/lib/apt/lists/*

# Copy backend requirements first for layer caching
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the entire repo (including backend/.env if present — it's gitignored)
COPY . .

# The .env file is loaded at runtime by storage.py (backend/.env)
# The Python imports (from connectors., from models., etc.) expect to run from backend/
WORKDIR /app/backend

# HF Spaces routes traffic to port 7860 by default
EXPOSE 7860

# Start the FastAPI server
CMD ["uvicorn", "api.server:app", "--host", "0.0.0.0", "--port", "7860"]