Spaces:
Running
Running
FROM python:3.9-slim-bullseye | |
# 安装系统依赖 | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
gcc \ | |
libssl-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
# 设置工作目录 | |
WORKDIR /app | |
# 复制必要文件 | |
COPY app.py requirements.txt ./ | |
# 安装Python依赖 | |
RUN pip install --no-cache-dir -r requirements.txt && \ | |
pip install gunicorn==20.1.0 | |
# 设置环境变量 | |
ENV PORT=7860 \ | |
FLASK_ENV=production | |
# 暴露指定端口 | |
EXPOSE 7860 | |
# 启动命令 - 直接使用Flask运行而非Gunicorn | |
CMD ["python", "app.py"] | |