YouTubeapi / Dockerfile
Liangjiejie's picture
Update Dockerfile
9589323 verified
raw
history blame contribute delete
741 Bytes
# 基础镜像:使用官方 Python 3.10
FROM python:3.10
# 设置容器内的工作目录
WORKDIR /app
# 1. 复制依赖文件
# (确保 requirements.txt 在 GitHub 仓库根目录)
COPY requirements.txt .
# 2. 安装所有依赖
RUN pip install --no-cache-dir -r requirements.txt
# 3. 复制所有应用代码
# (确保 app.py 和其他依赖文件在 GitHub 仓库根目录)
COPY . .
# 4. 暴露容器端口 (Hugging Face Spaces 默认使用 7860)
EXPOSE 7860
# 5. 启动应用:使用 Gunicorn 运行 app.py 中的 'app' 实例
# ----------------------------------------------------------------------
# 修复 ModuleNotFoundError: 'app:app' 指向 app.py 文件的 'app' 变量
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860"]