dots_ocr_explore / Dockerfile
Vishwas1's picture
Update Dockerfile
8aa2607 verified
FROM python:3.10
# System deps
RUN apt-get update && apt-get install -y \
git git-lfs ffmpeg libgl1 libsm6 libxext6 build-essential \
&& rm -rf /var/lib/apt/lists/* && git lfs install
WORKDIR /workspace
# Env: force CPU, set Gradio defaults
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
HF_HUB_ENABLE_HF_TRANSFER=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_SERVER_PORT=7860 \
CUDA_VISIBLE_DEVICES=""
# Faster pip
RUN python -m pip install -U pip
# 1) PyTorch CPU (no CUDA index URL)
RUN pip install torch==2.7.0 torchvision==0.22.0
# 2) App requirements (keep torch & dots.ocr OUT of requirements.txt)
COPY requirements.txt .
RUN pip install -r requirements.txt
# 3) Dots OCR runtime deps (GPU-free set) that the package expects
# We install them explicitly so we can install dots.ocr with --no-deps
RUN pip install \
transformers==4.51.3 \
modelscope==1.29.0 \
gradio_image_annotation==0.4.0 \
openai==1.99.9 \
qwen_vl_utils==0.0.11 \
sentencepiece \
"protobuf<4"
# 4) Install dots.ocr WITHOUT auto-deps (prevents flash-attn install on CPU)
RUN pip install --no-deps git+https://github.com/rednote-hilab/dots.ocr.git
# 5) App code
COPY . .
EXPOSE 7860
CMD ["python", "app.py"]