25 lines
687 B
Docker
25 lines
687 B
Docker
FROM continuumio/miniconda3:latest
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装 Python 3.12 和 pymetis (通过 conda-forge 避免编译问题)
|
|
RUN conda install -y -c conda-forge python=3.12 pymetis && \
|
|
conda clean -afy
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 将代码放入子目录 'app',将数据放入子目录 'db_inp'
|
|
# 这样临时文件默认会生成在 /app 下,而代码在 /app/app 下,实现了分离
|
|
COPY app ./app
|
|
COPY db_inp ./db_inp
|
|
COPY temp ./temp
|
|
COPY .env .
|
|
|
|
# 设置 PYTHONPATH 以便 uvicorn 找到 app 模块
|
|
ENV PYTHONPATH=/app
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]
|