forked from Bogdanovich77/DeekSeek-OCR---Dockerized-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (51 loc) · 2.16 KB
/
Copy pathDockerfile
File metadata and controls
68 lines (51 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# DeepSeek-OCR vLLM Docker Image
# Based on official vLLM OpenAI image for better compatibility
FROM vllm/vllm-openai:v0.8.5
# Switch to root user to install packages
USER root
# Set working directory
WORKDIR /app
# Copy the DeepSeek-OCR vLLM implementation
COPY DeepSeek-OCR/DeepSeek-OCR-master/DeepSeek-OCR-vllm/ ./DeepSeek-OCR-vllm/
# Copy custom files to replace the originals (transparent replacement approach)
COPY custom_config.py ./DeepSeek-OCR-vllm/config.py
COPY custom_image_process.py ./DeepSeek-OCR-vllm/process/image_process.py
COPY custom_deepseek_ocr.py ./DeepSeek-OCR-vllm/deepseek_ocr.py
# Copy custom run scripts to replace the originals
COPY custom_run_dpsk_ocr_pdf.py ./DeepSeek-OCR-vllm/run_dpsk_ocr_pdf.py
COPY custom_run_dpsk_ocr_image.py ./DeepSeek-OCR-vllm/run_dpsk_ocr_image.py
COPY custom_run_dpsk_ocr_eval_batch.py ./DeepSeek-OCR-vllm/run_dpsk_ocr_eval_batch.py
# Copy the startup script
COPY start_server.py .
# Copy requirements file and install additional dependencies
COPY DeepSeek-OCR/requirements.txt .
# Install Python dependencies excluding conflicting packages
RUN pip install --no-cache-dir \
PyMuPDF \
img2pdf \
einops \
easydict \
addict \
Pillow \
numpy
# Install additional dependencies for the API server
RUN pip install --no-cache-dir \
fastapi==0.104.1 \
uvicorn[standard]==0.24.0 \
python-multipart==0.0.6
# Install flash-attn for optimal performance (if not already included)
RUN pip install --no-cache-dir flash-attn==2.7.3 --no-build-isolation || echo "flash-attn may already be installed"
# Downgrade tokenizers to compatible version if needed
RUN pip install --no-cache-dir tokenizers==0.13.3 || echo "Using existing tokenizers version"
# Add the DeepSeek-OCR directory to PYTHONPATH
ENV PYTHONPATH="/app/DeepSeek-OCR-vllm:${PYTHONPATH}"
# Create directories for outputs
RUN mkdir -p /app/outputs
# Make the scripts executable
RUN chmod +x /app/start_server.py
# Expose the API port
EXPOSE 8000
# Set the default command to use our custom server
# Override the entrypoint to run our script directly
# Use the full path to python to avoid PATH issues
ENTRYPOINT ["/usr/bin/python3", "/app/start_server.py"]