|
FROM python:3.9-slim
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
libpq-dev \
|
|
tesseract-ocr \
|
|
poppler-utils \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
RUN git clone https://github.com/opendatalab/MinerU.git /tmp/MinerU \
|
|
&& cd /tmp/MinerU \
|
|
&& pip install -e . \
|
|
&& cp -r /tmp/MinerU/magic_pdf /app/magic_pdf \
|
|
&& rm -rf /tmp/MinerU
|
|
|
|
|
|
COPY requirements.txt .
|
|
COPY app.py .
|
|
COPY download_models.py .
|
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
RUN python download_models.py
|
|
|
|
|
|
ENV PORT=7860
|
|
ENV PYTHONPATH=/app:$PYTHONPATH
|
|
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"] |