-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
41 lines (32 loc) · 1.1 KB
/
dockerfile
File metadata and controls
41 lines (32 loc) · 1.1 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
FROM --platform=linux/amd64 python:3.9-slim
# Set working directory
WORKDIR /app
# Install system dependencies including tesseract for OCR and common build tools
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
tesseract-ocr \
tesseract-ocr-eng \
tesseract-ocr-jpn \
tesseract-ocr-chi-sim \
tesseract-ocr-ara \
tesseract-ocr-hin \
tesseract-ocr-kor \
libgl1 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean --yes
# Copy requirements first for better caching
COPY requirements.txt .
# Upgrade pip and install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY . .
# Create input and output directories
RUN mkdir -p /app/input /app/output
# Set environment variables
ENV PYTHONPATH=/app
ENV TESSDATA_PREFIX=/usr/share/tesseract-ocr/4.00/tessdata
# Use non-root user for security
RUN adduser --disabled-password --gecos "" appuser && chown -R appuser:appuser /app
USER appuser
# Set the entrypoint
ENTRYPOINT ["python", "main.py"]