# 使用 Hugging Face 官方 Python 基础镜像 FROM python:3.11 # 设置工作目录 WORKDIR /app # 复制 requirements.txt 并安装 Python 依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 安装 Playwright 浏览器和所有系统依赖 # --with-deps 参数至关重要,它会安装所有需要的系统库 RUN playwright install firefox --with-deps # 复制应用代码到容器内 COPY . . # Gradio 默认在 7860 端口运行 EXPOSE 7860 # 容器启动时执行的命令 CMD ["python", "app.py"]