FROM python:3.10-slim WORKDIR /app # 安装基本依赖 RUN apt-get update && \ apt-get install -y curl && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* # 创建缓存目录 RUN mkdir -p /app/cache && \ chmod 777 /app/cache # 安装 Python 依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 复制应用文件 COPY . . # 暴露端口 EXPOSE 7860 # 启动命令 CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]