ror-12 commited on
Commit
b81be73
·
verified ·
1 Parent(s): eed1bc9
Files changed (1) hide show
  1. Dockerfile +19 -8
Dockerfile CHANGED
@@ -1,17 +1,27 @@
1
  # Use a lightweight Python image
2
  FROM python:3.10-slim
3
 
4
- # 1. Install System Dependencies
5
- # 'libgl1' replaces 'libgl1-mesa-glx'
6
- # 'libglib2.0-0' is often needed for cv2/vision
 
 
7
  RUN apt-get update && apt-get install -y \
 
 
 
 
8
  poppler-utils \
9
  libgl1 \
10
  libglib2.0-0 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # 2. Install Python Libraries
14
- RUN pip install --no-cache-dir \
 
 
 
 
15
  "llama-cpp-python[server]" \
16
  huggingface_hub \
17
  pdf2image \
@@ -20,13 +30,14 @@ RUN pip install --no-cache-dir \
20
  fastapi \
21
  pillow
22
 
23
- # 3. Download the Model during build
 
24
  RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF qwen2-vl-7b-instruct-q4_k_m.gguf --local-dir /app/model
25
  RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF mmproj-model-f16.gguf --local-dir /app/model
26
 
27
- # 4. Copy your API code
28
  WORKDIR /app
29
  COPY app.py .
30
 
31
- # 5. Run the API Server
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Use a lightweight Python image
2
  FROM python:3.10-slim
3
 
4
+ # 1. Install System Dependencies (Compilers + PDF tools)
5
+ # - build-essential: contains gcc, g++, make (REQUIRED for llama-cpp-python)
6
+ # - cmake: required to build the build system
7
+ # - poppler-utils: required for pdf2image
8
+ # - libgl1: required for opencv/vision tasks
9
  RUN apt-get update && apt-get install -y \
10
+ build-essential \
11
+ cmake \
12
+ g++ \
13
+ gcc \
14
  poppler-utils \
15
  libgl1 \
16
  libglib2.0-0 \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # 2. Upgrade pip (good practice)
20
+ RUN pip install --upgrade pip
21
+
22
+ # 3. Install Python Libraries
23
+ # We force a reinstall with --no-cache-dir to avoid using broken cached wheels
24
+ RUN CMAKE_ARGS="-DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS" pip install --no-cache-dir \
25
  "llama-cpp-python[server]" \
26
  huggingface_hub \
27
  pdf2image \
 
30
  fastapi \
31
  pillow
32
 
33
+ # 4. Download the Model
34
+ # Using the GGUF (CPU-optimized) version
35
  RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF qwen2-vl-7b-instruct-q4_k_m.gguf --local-dir /app/model
36
  RUN huggingface-cli download Qwen/Qwen2-VL-7B-Instruct-GGUF mmproj-model-f16.gguf --local-dir /app/model
37
 
38
+ # 5. Copy your API code
39
  WORKDIR /app
40
  COPY app.py .
41
 
42
+ # 6. Run the API Server
43
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]