# 基础镜像
FROM python:3.12-slim

# 设置工作目录
WORKDIR /app

# 先复制 requirements.txt 并安装依赖，利用 Docker 镜像缓存（使用清华镜像源加速）
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

# 复制整个项目代码到容器
COPY . .

# 暴露端口
EXPOSE 8005

# 启动命令：运行 main.py 中的 FastAPI 应用
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8005"]