NEXAS commited on
Commit
7b5b47d
·
verified ·
1 Parent(s): ac19dde

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -5
Dockerfile CHANGED
@@ -1,22 +1,33 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.10-slim
3
 
4
  # Set environment variables
5
  ENV PYTHONUNBUFFERED=1 \
6
  PYTHONDONTWRITEBYTECODE=1 \
7
  HOME=/home/user \
8
- PATH=/home/user/.local/bin:$PATH
 
 
9
 
10
  # Create a non-root user
11
  RUN useradd -m -u 1000 user
12
  WORKDIR $HOME/app
13
 
14
- # Install system dependencies
 
 
 
 
15
  RUN apt-get update && apt-get install -y \
16
  build-essential \
17
  libgomp1 \
18
- libgl1 \
19
  libglib2.0-0 \
 
 
 
 
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # Install requirements
@@ -26,6 +37,10 @@ RUN pip install --no-cache-dir -r requirements.txt
26
  # Copy the application code and set ownership
27
  COPY --chown=user:user . .
28
 
 
 
 
 
29
  # Switch to the non-root user
30
  USER user
31
 
 
1
+ # Use a more robust Python runtime as a parent image (Bookworm instead of Slim)
2
+ FROM python:3.10-bookworm
3
 
4
  # Set environment variables
5
  ENV PYTHONUNBUFFERED=1 \
6
  PYTHONDONTWRITEBYTECODE=1 \
7
  HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH \
9
+ HF_HOME=/home/user/.cache/huggingface \
10
+ DOCLING_MODELS_CACHE=/home/user/.cache/docling/models
11
 
12
  # Create a non-root user
13
  RUN useradd -m -u 1000 user
14
  WORKDIR $HOME/app
15
 
16
+ # Install critical system dependencies for Docling, OpenCV, and OCR
17
+ # libgl1-mesa-glx and libglib2.0-0 are for OpenCV
18
+ # libsm6, libxext6, libxrender1 are for UI-less PDF processing
19
+ # tesseract-ocr is for fallback OCR layers
20
+ # libmagic1 is for file type detection
21
  RUN apt-get update && apt-get install -y \
22
  build-essential \
23
  libgomp1 \
24
+ libgl1-mesa-glx \
25
  libglib2.0-0 \
26
+ libsm6 \
27
+ libxext6 \
28
+ libxrender1 \
29
+ tesseract-ocr \
30
+ libmagic1 \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
  # Install requirements
 
37
  # Copy the application code and set ownership
38
  COPY --chown=user:user . .
39
 
40
+ # Ensure cache directories exist and are writable by the user
41
+ RUN mkdir -p .llama_cache $HF_HOME $DOCLING_MODELS_CACHE && \
42
+ chown -R user:user $HOME
43
+
44
  # Switch to the non-root user
45
  USER user
46