File size: 1,153 Bytes
2f4af3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# DecipherAI Backend — Hugging Face Spaces Docker Configuration
# Space SDK: Docker
# Port: 7860

FROM python:3.11-slim

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    tesseract-ocr \
    wget \
    libgl1 \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Download Ancient Greek Tesseract model
RUN mkdir -p /usr/share/tesseract-ocr/5/tessdata && \
    wget -q \
    https://github.com/tesseract-ocr/tessdata/raw/main/grc.traineddata \
    -O /usr/share/tesseract-ocr/5/tessdata/grc.traineddata

# Create non-root user (HF Spaces recommendation)
RUN useradd -m -u 1000 user

USER user

ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH

WORKDIR /home/user/app

# Install Python dependencies
COPY --chown=user:user requirements.txt .

RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy application
COPY --chown=user:user . .

# Hugging Face Space port
EXPOSE 7860

# Production server
CMD ["gunicorn", \
     "--bind", "0.0.0.0:7860", \
     "--workers", "1", \
     "--timeout", "300", \
     "--preload", \
     "app:app"]