minerU / Dockerfile
uatjonas's picture
Update Dockerfile
f12a6ae verified
FROM python:3.10-slim
# 1. Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
wget \
git \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# 2. Set up the user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# 3. Copy requirements
COPY --chown=user requirements.txt .
# 4. Upgrade pip
RUN pip install --no-cache-dir --upgrade pip
# 5. Install PyTorch (CPU Version) FIRST
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# 6. Install Detectron2 from Source (Official Facebook Repo)
# FIX: Added '--no-build-isolation' so it can see the installed PyTorch
RUN pip install --no-cache-dir --no-build-isolation "git+https://github.com/facebookresearch/detectron2.git"
# 7. Install the rest of the dependencies
RUN pip install --no-cache-dir -r requirements.txt
# 8. Copy the application
COPY --chown=user . .
# 9. Run the application
CMD ["python", "app.py"]