# Dockerfile # 使用官方的 Python 基础镜像 FROM python:3.11-slim # 将工作目录设置为 /app WORKDIR /app # 将依赖文件复制到镜像中 COPY requirements.txt . # 安装依赖 RUN pip install --no-cache-dir -r requirements.txt # 将你项目中的所有文件(app.py, voices/ 文件夹等)复制到镜像中 COPY . . # 暴露端口 7860 (Hugging Face Spaces 的标准端口) EXPOSE 7860 # 运行 Gunicorn 服务器的命令 # 它会启动 1 个工作进程来运行你的 app.py 中的 'app' 对象 CMD ["gunicorn", "--workers", "1", "--bind", "0.0.0.0:7860", "app:app"]