-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 1.16 KB
/
Copy pathDockerfile
File metadata and controls
39 lines (29 loc) · 1.16 KB
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
# ---------- Base Stage ----------
FROM pytorch/pytorch:2.7.1-cuda12.8-cudnn9-devel AS base
WORKDIR /app
# System dependencies:
# Added 'poppler-utils' for PDF processing
# Added 'libpcsclite1' which some OCR tools occasionally peek at
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
poppler-utils \
&& rm -rf /var/lib/apt/lists/*
# Create local folders to ensure they exist for the volume mounts
RUN mkdir -p /app/data /app/output
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ---------- Dev / Test Stage ----------
FROM base AS dev
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
# Install dev dependencies (pytest, etc.)
COPY requirements-dev.txt .
RUN pip install --no-cache-dir -r requirements-dev.txt
COPY . .
# Pre-download the Blackwell-friendly model
RUN python3 -c "from doctr.models import ocr_predictor; ocr_predictor(reco_arch='vitstr_base', pretrained=True)"
# Pre-download the embedding model
RUN python3 -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-mpnet-base-v2')"
CMD ["python", "src/main.py"]