Update Dockerfile
Browse files- Dockerfile +11 -26
Dockerfile
CHANGED
|
@@ -1,31 +1,16 @@
|
|
| 1 |
-
# Use
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
#
|
| 9 |
-
RUN
|
| 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 |
-
#
|
| 31 |
-
CMD ["
|
|
|
|
| 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"]
|