File size: 546 Bytes
8d17ae3 c2417ea 8d17ae3 c2417ea 8d17ae3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 使用官方 Python 轻量镜像
FROM python:3.10-slim
# 设置工作目录
WORKDIR /app
# 复制依赖文件
COPY requirements.txt /app/
# 【关键修改】使用官方提供的预编译 CPU wheel 加速安装
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
# 复制当前目录下所有文件到容器的 /app 中
COPY . /app/
# 暴露 HF Spaces 要求的端口
EXPOSE 7860
# 启动服务
CMD ["python", "app.py"] |