FROM python:3.10-slim # 安装系统依赖 RUN apt-get update && apt-get install -y \ build-essential \ && rm -rf /var/lib/apt/lists/* # 安装 PyTorch RUN pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cpu # 安装其他依赖 COPY requirements.txt . RUN pip install -r requirements.txt huggingface-hub # 拷贝代码 COPY . /app WORKDIR /app # 入口 CMD ["python", "app.py"]