redhairedshanks1 commited on
Commit
06193e8
·
verified ·
1 Parent(s): d1fb649

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Set environment variables
4
+ ENV PYTHONDONTWRITEBYTECODE=1
5
+ ENV PYTHONUNBUFFERED=1
6
+ ENV HOME=/app
7
+ ENV PADDLEOCR_HOME=/app/.paddleocr
8
+
9
+ WORKDIR /app
10
+
11
+ # Create writable OCR model directory and non-root user
12
+ RUN mkdir -p /app/.paddleocr && \
13
+ adduser --disabled-password --gecos '' appuser && \
14
+ chown -R appuser:appuser /app
15
+
16
+ # Install system dependencies
17
+ RUN apt-get update && \
18
+ apt-get install -y --no-install-recommends \
19
+ poppler-utils \
20
+ tesseract-ocr \
21
+ libgl1-mesa-glx \
22
+ libglib2.0-0 \
23
+ libsm6 \
24
+ libxext6 \
25
+ libxrender-dev \
26
+ libgl1 \
27
+ libglib2.0-dev \
28
+ libcairo2 \
29
+ libpango1.0-0 \
30
+ libpangocairo-1.0-0 \
31
+ libgdk-pixbuf2.0-0 \
32
+ python3-tk \
33
+ ghostscript \
34
+ libgomp1 \
35
+ curl \
36
+ && apt-get clean && \
37
+ rm -rf /var/lib/apt/lists/*
38
+
39
+ # Install Python packages
40
+ COPY requirements.txt .
41
+ RUN pip install --upgrade pip && \
42
+ pip install --no-cache-dir -r requirements.txt
43
+
44
+ # Copy application code
45
+ COPY . .
46
+
47
+ # Switch to non-root user
48
+ USER appuser
49
+
50
+ # Expose port 3001
51
+ EXPOSE 3001
52
+
53
+ # Start app
54
+ CMD ["python", "app.py"]