FROM python:3.13-slim WORKDIR /app # 合并安装 git、wget 和其他必要依赖,最后清理 apt 缓存以减小镜像体积 RUN apt-get update && apt-get install -y git wget && rm -rf /var/lib/apt/lists/* # 克隆 SHARP 仓库 RUN git clone https://github.com/apple/ml-sharp.git /app/ml-sharp WORKDIR /app/ml-sharp # 安装 Python 依赖 RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir gradio RUN pip install --no-cache-dir trimesh plyfile # 下载模型 WORKDIR /app RUN mkdir -p /app/checkpoints && \ wget -P /app/checkpoints https://ml-site.cdn-apple.com/models/sharp/sharp_2572gikvuh.pt # 下载 gaussian-splats-3d ES 模块文件(使用 unpkg 源) RUN mkdir -p /app/static && \ wget -O /app/static/gaussian-splats-3d.module.js \ https://unpkg.com/@mkkellogg/gaussian-splats-3d@0.4.7/build/gaussian-splats-3d.module.js # 复制应用代码 COPY app.py /app/app.py EXPOSE 7860 CMD ["python", "app.py"]