File size: 865 Bytes
84c3ae8
 
 
 
 
 
 
 
 
 
 
 
 
e7e01d1
dd2116b
e7e01d1
 
84c3ae8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7e01d1
84c3ae8
 
 
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
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/*

# 克隆 MinerU 项目并安装
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 .

# 安装 Python 依赖
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"]