2026-09-16 17:55:04 +08:00
|
|
|
# PythonOCC 仅经 conda-forge 提供,且其动态库与 conda Python 的 ABI 绑定。
|
|
|
|
|
# 旧方式(conda 环境装好后把 site-packages 拷入 python:slim 系统 python)依赖
|
|
|
|
|
# 两侧 Python ABI 恰好兼容,属脆弱做法(TECH_DEBT D13);现改为直接以同一
|
|
|
|
|
# conda 运行时作为最终镜像的执行环境,自带全部动态库。
|
|
|
|
|
FROM continuumio/miniconda3:24.7.1-0
|
|
|
|
|
|
|
|
|
|
# 锁定几何栈核心版本;pip 侧全量版本锁待首次镜像构建成功后由
|
|
|
|
|
# `pip freeze > deploy/requirements-moldinsight.lock.txt` 生成(D13 遗留项)
|
|
|
|
|
RUN conda create -n moldinsight -c conda-forge -y \
|
|
|
|
|
python=3.12 \
|
|
|
|
|
pythonocc-core=7.9.0 \
|
|
|
|
|
&& conda clean -afy
|
|
|
|
|
|
|
|
|
|
ENV PATH=/opt/conda/envs/moldinsight/bin:$PATH \
|
|
|
|
|
PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
# 自包含构建:不再基于 gemold-base,基础依赖与模块依赖一并安装
|
|
|
|
|
COPY deploy/requirements-base.txt deploy/requirements-moldinsight.txt ./
|
|
|
|
|
RUN pip install --no-cache-dir \
|
|
|
|
|
-r requirements-base.txt \
|
|
|
|
|
-r requirements-moldinsight.txt \
|
|
|
|
|
&& rm requirements-base.txt requirements-moldinsight.txt
|
|
|
|
|
|
|
|
|
|
COPY src/shared/ /app/src/shared/
|
2026-05-29 18:19:30 +08:00
|
|
|
COPY src/moldinsight/ /app/src/moldinsight/
|
|
|
|
|
COPY src/inventory/ /app/src/inventory/
|
|
|
|
|
COPY src/entrypoints/ /app/src/entrypoints/
|
|
|
|
|
COPY src/celery_app.py src/celery_tasks.py /app/src/
|
2026-09-16 17:55:04 +08:00
|
|
|
|
|
|
|
|
# init_db 启动期自动迁移(AUTO_MIGRATE)需要迁移脚本随镜像分发
|
|
|
|
|
COPY migrations/ /app/migrations/
|
|
|
|
|
COPY alembic.ini /app/alembic.ini
|
|
|
|
|
|
2026-05-29 18:19:30 +08:00
|
|
|
COPY uploads/ /app/uploads/
|
|
|
|
|
COPY html_output/ /app/html_output/
|
|
|
|
|
|
2026-09-16 17:55:04 +08:00
|
|
|
ENV PYTHONPATH=/app/src
|
|
|
|
|
|
2026-05-29 18:19:30 +08:00
|
|
|
RUN mkdir -p /app/logs
|
|
|
|
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
|
|
|
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
|
|
|
|
|
|
|
|
|
|
CMD ["python", "-m", "uvicorn", "entrypoints.moldinsight:app", "--host", "0.0.0.0", "--port", "8000"]
|