# 使用 Ollama 官方镜像作为基础 FROM ollama/ollama:latest # 安装 Python3 和 pip RUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/* # 安装 Gradio 和 requests RUN pip3 install gradio requests # 在构建阶段拉取模型(避免每次启动都下载) RUN ollama pull huihui_ai/deepseek-r1-abliterated:1.5b # 复制应用脚本和启动脚本 COPY app.py /app.py COPY start.sh /start.sh RUN chmod +x /start.sh # 暴露 Gradio 服务端口(Hugging Face Space 默认使用 7860) EXPOSE 7860 # 启动容器时执行启动脚本 CMD ["/start.sh"]