HoagMin commited on
Commit
73ab3e2
·
1 Parent(s): fce3810
Files changed (2) hide show
  1. Dockerfile +5 -11
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,10 +1,9 @@
1
  FROM python:3.11-slim
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,20 +17,15 @@ WORKDIR /home/user/app
18
 
19
  COPY --chown=user:user requirements.txt .
20
 
21
- # 1. Cài đặt các thư viện cơ bản từ requirements.txt
22
  RUN pip install --upgrade pip && \
23
  pip install --no-cache-dir -r requirements.txt
24
 
25
- # 2. Cài riêng PaddlePaddle để tránh quá tải RAM
26
  RUN pip install --no-cache-dir paddlepaddle
27
 
28
- # 3. CHIẾN THUẬT INSTALL & SWAP:
29
- # - Cài paddleocr bình thường (bỏ --no-deps) để nó tự kéo paddlex và các thư viện khác.
30
- # - Sau đó gỡ ngay bản opencv-python có giao diện để tránh xung đột.
31
- # - Đảm bảo opencv-python-headless vẫn tồn tại.
32
- RUN pip install --no-cache-dir paddleocr && \
33
- pip uninstall -y opencv-python opencv-contrib-python && \
34
- pip install --no-cache-dir opencv-python-headless>=4.7.0.72
35
 
36
  COPY --chown=user:user . .
37
 
 
1
  FROM python:3.11-slim
2
 
3
  ENV PATH="/home/user/.local/bin:${PATH}"
 
 
4
  ENV YOLO_CONFIG_DIR="/tmp/Ultralytics"
5
 
6
+ # Đã có đủ các thư viện core để chạy bản OpenCV đầy đủ
7
  RUN apt-get update && apt-get install -y \
8
  libgl1 \
9
  libglib2.0-0 \
 
17
 
18
  COPY --chown=user:user requirements.txt .
19
 
20
+ # 1. Cài các thư viện cơ bản
21
  RUN pip install --upgrade pip && \
22
  pip install --no-cache-dir -r requirements.txt
23
 
24
+ # 2. Cài PaddlePaddle ở một bước riêng biệt để tránh sập RAM
25
  RUN pip install --no-cache-dir paddlepaddle
26
 
27
+ # 3. Cài PaddleOCR bình thường (sẽ tự động dùng chung opencv-python với YOLO)
28
+ RUN pip install --no-cache-dir paddleocr
 
 
 
 
 
29
 
30
  COPY --chown=user:user . .
31
 
requirements.txt CHANGED
@@ -5,4 +5,4 @@ google-genai
5
  python-dotenv
6
  numpy
7
  gunicorn
8
- opencv-python-headless
 
5
  python-dotenv
6
  numpy
7
  gunicorn
8
+