HoagMin commited on
Commit
f2499d3
·
1 Parent(s): a9c6981
Files changed (2) hide show
  1. Dockerfile +19 -5
  2. requirements.txt +2 -2
Dockerfile CHANGED
@@ -1,13 +1,27 @@
1
  FROM python:3.11-slim
2
 
3
- WORKDIR /app
4
 
5
- # Install libGL thay thế (fix libGL.so.1)
6
- RUN apt-get update && apt-get install -y libgl1 libglib2.0-0 && rm -rf /var/lib/apt/lists/*
 
 
 
 
7
 
8
- COPY . /app
 
9
 
10
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
 
 
11
 
12
  EXPOSE 7860
13
 
 
1
  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 \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
 
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
 
15
+ 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
 
26
  EXPOSE 7860
27
 
requirements.txt CHANGED
@@ -5,5 +5,5 @@ google-genai
5
  python-dotenv
6
  numpy
7
  gunicorn
8
- opencv-python-headless==4.5.5.64
9
- paddleocr --no-deps
 
5
  python-dotenv
6
  numpy
7
  gunicorn
8
+ opencv-python-headless
9
+ paddleocr