File size: 1,506 Bytes
b25a606
 
21ee11e
b25a606
 
21ee11e
8b29810
21ee11e
 
 
 
8b29810
 
21ee11e
 
 
b25a606
c661538
 
 
21ee11e
 
 
b25a606
 
21ee11e
b25a606
 
 
21ee11e
aeaa1d3
21ee11e
 
c661538
 
 
aeaa1d3
 
 
 
c661538
c09c289
 
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
# HuggingFace Spaces compatible Dockerfile
FROM python:3.8-slim

# Set working directory
WORKDIR /app

# Install system dependencies needed for mmcv compilation and OpenCV
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        git \
        build-essential \
        cmake \
        ninja-build \
        libsm6 \
        libxext6 \
        libgl1 \
        libglib2.0-0 \
        libssl-dev \
        wget \
        curl && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

# Copy requirements
COPY requirements.txt /app/

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
    pip install --no-cache-dir -r requirements.txt

# Copy application code (excluding large files via .dockerignore)
COPY . /app/

# Create checkpoint directory
RUN mkdir -p /app/finetuning_rodla/finetuning_rodla/checkpoints

# Optional: Attempt to download weights at build time (non-blocking)
# If download fails or times out, the backend will fall back to heuristic detection
# Weights can be manually placed in: /app/finetuning_rodla/finetuning_rodla/checkpoints/rodla_internimage_xl_publaynet.pth
RUN timeout 300 python /app/deployment/backend/download_weights.py 2>&1 || echo "⚠️  Weight download timed out or failed - backend will use heuristic detection. To enable full detection, manually place weights file in checkpoints directory."

# Run backend.py on port 7860 (HuggingFace standard)
CMD ["python", "deployment/backend/backend.py"]