28 lines
836 B
Docker
28 lines
836 B
Docker
FROM condaforge/miniforge3:latest
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
PIP_TRUSTED_HOST=pypi.tuna.tsinghua.edu.cn \
|
|
UV_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
# 安装 Python 3.12 和 pymetis (通过 conda-forge 避免编译问题)
|
|
RUN mamba install -y python=3.12 pymetis && \
|
|
mamba clean -afy
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir uv
|
|
RUN uv pip install --system --no-cache-dir -r requirements.txt
|
|
|
|
# 将代码放入子目录 'app',临时数据目录运行时创建。
|
|
# db_inp 和 .env 都不应依赖 Git 跟踪或被烘焙进镜像。
|
|
COPY app ./app
|
|
RUN mkdir -p ./db_inp
|
|
|
|
# 设置 PYTHONPATH 以便 uvicorn 找到 app 模块
|
|
ENV PYTHONPATH=/app
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
|