Spaces:
Paused
Paused
| # 1. 使用与 README 要求一致的 PyTorch 版本 | |
| FROM pytorch/pytorch:2.4.1-cuda12.1-cudnn9-devel | |
| # 设置非交互式安装 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # 2. 安装系统依赖 | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| git-lfs \ | |
| ffmpeg \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 设置工作目录 | |
| WORKDIR /app | |
| # 3. 克隆仓库 | |
| RUN git clone https://github.com/MeiGen-AI/InfiniteTalk.git | |
| # 进入仓库目录 | |
| WORKDIR /app/InfiniteTalk | |
| # 4. 安装 Python 依赖 (关键修改在这里!!!) | |
| RUN pip install --no-cache-dir --upgrade pip | |
| # 确保安装了编译工具 (ninja, packaging 等) | |
| RUN pip install --no-cache-dir ninja packaging wheel setuptools | |
| # 【核心修复】加上 --no-build-isolation | |
| # 这样它就能找到镜像里自带的 torch 了 | |
| RUN pip install --no-cache-dir --no-build-isolation flash_attn==2.7.4.post1 | |
| # 继续安装其他依赖 | |
| RUN pip install -U xformers==0.0.28 --index-url https://download.pytorch.org/whl/cu121 | |
| RUN pip install --no-cache-dir misaki[en] psutil | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN pip install --no-cache-dir gradio huggingface_hub | |
| # 5. 设置权限 | |
| RUN useradd -m -u 1000 user | |
| RUN chown -R user:user /app | |
| USER user | |
| # 6. 环境变量 | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| # 7. 复制启动脚本 (确保你有 run.py) | |
| COPY --chown=user:user run.py /app/InfiniteTalk/run.py | |
| # 8. 启动 | |
| CMD ["python", "run.py"] |