Spaces:
Running
Running
| # 使用官方 Python 镜像 | |
| FROM python:3.11-slim | |
| WORKDIR /app | |
| # 安装系统依赖 | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 安装 Python 依赖 | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple | |
| # 复制项目文件 | |
| COPY . . | |
| # 设置环境变量 | |
| ENV PYTHONUNBUFFERED=1 | |
| ENV PORT=7860 | |
| ENV HOST=0.0.0.0 | |
| # Hugging Face Spaces 使用 7860 端口 | |
| EXPOSE 7860 | |
| # 启动命令 | |
| CMD uvicorn main:app --host $HOST --port $PORT | |