HoagMin commited on
Commit
c177651
·
1 Parent(s): faf3e0e
Files changed (2) hide show
  1. Dockerfile +12 -4
  2. requirements.txt +0 -1
Dockerfile CHANGED
@@ -2,7 +2,9 @@ FROM python:3.11-slim
2
 
3
  ENV PATH="/home/user/.local/bin:${PATH}"
4
 
5
- # Cài đặt thư viện hệ thống cần thiết cho OpenCV và các thư viện khác
 
 
6
  RUN apt-get update && apt-get install -y \
7
  libgl1 \
8
  libglib2.0-0 \
@@ -16,10 +18,16 @@ WORKDIR /home/user/app
16
 
17
  COPY --chown=user:user requirements.txt .
18
 
19
- # Nâng cấp pip, cài requirements.txt, sau đó cài riêng paddleocr với cờ --no-deps
20
  RUN pip install --upgrade pip && \
21
- pip install --no-cache-dir -r requirements.txt && \
22
- pip install --no-cache-dir paddleocr --no-deps
 
 
 
 
 
 
23
 
24
  COPY --chown=user:user . .
25
 
 
2
 
3
  ENV PATH="/home/user/.local/bin:${PATH}"
4
 
5
+ # Fix cảnh báo "not writable" của Ultralytics (YOLO)
6
+ ENV YOLO_CONFIG_DIR="/tmp/Ultralytics"
7
+
8
  RUN apt-get update && apt-get install -y \
9
  libgl1 \
10
  libglib2.0-0 \
 
18
 
19
  COPY --chown=user:user requirements.txt .
20
 
21
+ # 1. Cài đặt các thư viện bản trước
22
  RUN pip install --upgrade pip && \
23
+ pip install --no-cache-dir -r requirements.txt
24
+
25
+ # 2. Cài riêng PaddlePaddle và các thư viện hình học của OCR
26
+ # Việc tách riêng giúp tránh sập RAM khi build trên Hugging Face
27
+ RUN pip install --no-cache-dir paddlepaddle shapely pyclipper
28
+
29
+ # 3. Cài PaddleOCR (vẫn giữ --no-deps để bảo vệ bản OpenCV của YOLO)
30
+ RUN pip install --no-cache-dir paddleocr --no-deps
31
 
32
  COPY --chown=user:user . .
33
 
requirements.txt CHANGED
@@ -6,4 +6,3 @@ python-dotenv
6
  numpy
7
  gunicorn
8
  opencv-python-headless
9
- paddleocr
 
6
  numpy
7
  gunicorn
8
  opencv-python-headless