sarveshpatel commited on
Commit
f7beca4
·
verified ·
1 Parent(s): 6225c41

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV OMP_NUM_THREADS=2
6
+ ENV MKL_NUM_THREADS=2
7
+
8
+ # System dependencies (minimal)
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ libgl1 \
11
+ libglib2.0-0 \
12
+ libgomp1 \
13
+ && rm -rf /var/lib/apt/lists/* \
14
+ && apt-get clean
15
+
16
+ WORKDIR /app
17
+
18
+ # Create necessary directories with proper permissions
19
+ RUN mkdir -p /app/uploads /app/pdf_images /app/paddle_home /app/xdg_cache \
20
+ && chmod -R 777 /app
21
+
22
+ # Install Python dependencies
23
+ RUN pip install --no-cache-dir \
24
+ fastapi==0.110.0 \
25
+ uvicorn==0.29.0 \
26
+ python-multipart \
27
+ PyMuPDF \
28
+ Pillow
29
+
30
+ # Install PaddlePaddle and PaddleOCR
31
+ RUN pip install --no-cache-dir paddlepaddle==3.0.0
32
+ RUN pip install --no-cache-dir paddleocr
33
+
34
+ COPY app.py /app/app.py
35
+
36
+ EXPOSE 7860
37
+
38
+ # Use single worker to manage memory, increase timeout
39
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]