# 使用官方的 Python 3.10 镜像作为基础环境 FROM python:3.10 # 设置工作目录 WORKDIR /app # 先复制 requirements.txt 并安装依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 将当前目录下的所有文件 (包括 app.py) 复制到容器的 /app 目录下 COPY . . # 暴露抱脸要求的 7860 端口 EXPOSE 7860 # 告诉系统启动时运行哪条命令(注意 CMD 后面有空格) CMD ["python", "-u", "app.py"]