# 使用官方Python 3.9镜像作为基础镜像 FROM python:3.9 # 安装ffmpeg git RUN apt-get update && apt-get upgrade -y && \ apt-get install -y ffmpeg git # 克隆GitHub仓库到容器中的/app目录 RUN git clone https://github.com/ZTGeng/ChatGPT-Face.git /app # 设置工作目录 WORKDIR /app # 安装Python依赖 RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir -r requirements.txt # copy Wav2Lip预训练模型 RUN mkdir -p wav2lip/weights COPY wav2lip_gan.pth wav2lip/weights/wav2lip_gan.pth # copy google credentials RUN mkdir -p keys RUN chmod -R 777 /app/keys RUN mkdir -p temp RUN chmod -R 777 /app/temp ENV GOOGLE_APPLICATION_CREDENTIALS="keys/google-cloud-text-to-speech-key.json" ENV NUMBA_CACHE_DIR=/tmp/numba_cache # ENV NUMBA_DISABLE_JIT=1 # RUN chmod -R 755 /usr/local/lib/python3.9/site-packages/librosa # 暴露Flask运行所需的端口,假设为5000 EXPOSE 7860 # 复制启动脚本到容器 COPY start.sh /start.sh RUN chmod +x /start.sh # 使用启动脚本来运行Flask应用 CMD ["/start.sh"]