-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (40 loc) · 1.41 KB
/
Dockerfile
File metadata and controls
50 lines (40 loc) · 1.41 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
40
41
42
43
44
45
46
47
48
49
50
# Use Python 3.10 slim as base to keep image size check
FROM python:3.10-slim
# Install system dependencies
# - pandoc: for ODT conversion
# - git: for installing dependencies from git if needed
# - tesseract-ocr: for OCR support (if used by Docling/pdfplumber)
# - libgl1: for opencv if needed
RUN apt-get update && apt-get install -y \
pandoc \
git \
tesseract-ocr \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for caching
COPY requirements.txt .
# Install Python dependencies
# Use --no-cache-dir to keep image smaller
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir gunicorn gevent
# Copy application code
COPY . .
# Pre-install translation models to bake them into the image
# Set PYTHONPATH so internal imports in translation_utils work
ENV PYTHONPATH=/app/src
RUN python src/translation_utils.py || echo "Warning: Failed to install translation models during build. They will be installed on first use if needed."
# Create necessary directories
RUN mkdir -p uploads outputs
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV FLASK_APP=src/app.py
# Expose port
EXPOSE 5000
# Default command pointing to src.app module
CMD ["gunicorn", "-k", "gevent", "--workers", "1", "--timeout", "300", "--bind", "0.0.0.0:5000", "src.app:app"]