| FROM python:3.11-slim | |
| # 安装依赖 | |
| COPY requirements.txt /tmp/ | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| # 复制代码 | |
| COPY . /app | |
| WORKDIR /app | |
| # 运行 FastAPI | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |
| FROM python:3.11-slim | |
| # 安装依赖 | |
| COPY requirements.txt /tmp/ | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| # 复制代码 | |
| COPY . /app | |
| WORKDIR /app | |
| # 运行 FastAPI | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |