demo / Dockerfile
mrbear1024's picture
dockerfile
9c7a37f
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04
# 安装基础依赖和 Miniconda(来自 conda-forge 的 deb 包)
RUN apt-get update && apt-get install -y \
build-essential \
git \
wget \
ffmpeg \
libsndfile1 \
bzip2 \
curl \
ca-certificates \
software-properties-common \
&& curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o /tmp/miniconda.sh \
&& bash /tmp/miniconda.sh -b -p /opt/conda \
&& rm /tmp/miniconda.sh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# 添加 conda 到 PATH
ENV PATH="/opt/conda/bin:$PATH"
# 创建 conda 虚拟环境
RUN conda create -n mimictalk python=3.9 -y
# 安装 Python 依赖(用 conda run)
RUN conda run -n mimictalk pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu121
RUN conda run -n mimictalk pip install cython openmim==0.3.9
RUN conda run -n mimictalk mim install mmcv==2.1.0
# RUN conda run -n mimictalk pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"
# 安装项目依赖
COPY requirements.txt /tmp/
RUN conda run -n mimictalk pip install -r /tmp/requirements.txt
# 下载模型文件
RUN conda run -n mimictalk pip install huggingface_hub && \
conda run -n mimictalk python -c "from huggingface_hub import snapshot_download; snapshot_download('mrbear1024/demo-model', local_dir='/app/models')"
# 拷贝项目代码
COPY . /app
WORKDIR /app
# 启动命令(通过 conda 运行 Python 脚本)
CMD ["/opt/conda/bin/conda", "run", "--no-capture-output", "-n", "mimictalk", "python", "inference/app_mimictalk.py"]