chipling commited on
Commit
6a288d9
·
verified ·
1 Parent(s): 6664860

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -26
Dockerfile CHANGED
@@ -1,31 +1,16 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.10-slim
3
 
4
- # Set the working directory
5
- WORKDIR /app
 
 
6
 
7
- # Install system dependencies required by PaddleOCR and OpenCV
8
- # ADDED: libgomp1
9
- RUN apt-get update && apt-get install -y \
10
- libgl1 \
11
- libglib2.0-0 \
12
- libgomp1 \
13
- && rm -rf /var/lib/apt/lists/*
14
 
15
- # Create a non-root user required by Hugging Face Spaces
16
- RUN useradd -m -u 1000 user
17
- USER user
18
- ENV PATH="/home/user/.local/bin:$PATH"
19
-
20
- # Copy requirements and install
21
- COPY --chown=user requirements.txt .
22
- RUN pip install --no-cache-dir -r requirements.txt
23
-
24
- # Copy the rest of the application
25
- COPY --chown=user . .
26
-
27
- # Expose the port FastAPI runs on
28
  EXPOSE 7860
29
 
30
- # Command to run the application
31
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official lightweight CPU-only image from Docling
2
+ FROM quay.io/docling-project/docling-serve-cpu:latest
3
 
4
+ # Set environment variables for Hugging Face Spaces
5
+ ENV HOST=0.0.0.0
6
+ ENV PORT=7860
7
+ ENV DOCLING_SERVE_ENABLE_UI=1
8
 
9
+ # Pre-download the SmolDocling model to speed up startup (optional but recommended)
10
+ # This ensures the 256M model is ready in the container cache
11
+ RUN python3 -c "from docling.document_converter import DocumentConverter; DocumentConverter()"
 
 
 
 
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  EXPOSE 7860
14
 
15
+ # Start the server
16
+ CMD ["docling-serve", "run", "--host", "0.0.0.0", "--port", "7860"]