算法更新: delivery v1.2.1、平整度v1.5、测距v2.2、整车配准v1.3 适配器: vehicle-registration 新增、各算法 manifest 和 adapter 更新 后端: taskCadFiles/source 字段迁移、derivedPointClouds 注册、取消任务联动 前端: ElapsedTime 时长显示、两步算法流程、canRun 逻辑修复 文档: 新增5份算法性能分析报告
112 lines
5.1 KiB
Docker
112 lines
5.1 KiB
Docker
# 开发镜像(GPU):Ubuntu 22.04 + CUDA 12.1 runtime + Node 22 + cadquery + PyTorch(cu121) + PyTorch3D
|
||
# 用于装配检测「最近零件」服务端 GPU(scripts/assembly_nearest_gpu.py)
|
||
# 宿主机需:NVIDIA 驱动 + nvidia-container-toolkit;构建不要求 GPU,运行需 --gpus
|
||
#
|
||
# 构建:docker build -t massive-point-cloud-app-dev:local -f docker/Dockerfile.dev.gpu .
|
||
#
|
||
# 无 NVIDIA 的机器请改用 docker/Dockerfile.dev(仅 CPU),compose 中去掉 gpus 与 ASSEMBLY_USE_GPU
|
||
|
||
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive \
|
||
PYTHON3_PATH=/usr/bin/python3 \
|
||
ASSEMBLY_USE_GPU=1 \
|
||
NVIDIA_VISIBLE_DEVICES=all \
|
||
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||
|
||
# apt 换阿里云(国内构建加速);需官方源时可在下方注释掉本段
|
||
RUN set -eux; \
|
||
if [ -f /etc/apt/sources.list ]; then \
|
||
sed -i 's|http://archive.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list; \
|
||
sed -i 's|http://security.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list; \
|
||
fi
|
||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
python3 \
|
||
python3-pip \
|
||
python3-dev \
|
||
ca-certificates \
|
||
curl \
|
||
gnupg \
|
||
libgl1 \
|
||
libglib2.0-0 \
|
||
libxrender1 \
|
||
libxext6 \
|
||
libsm6 \
|
||
libice6 \
|
||
libx11-6 \
|
||
libgomp1 \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# CUDA runtime 镜像默认不带 nvidia-smi;装 Ubuntu 的 nvidia-utils(主版本与宿主机驱动大版本一致,如 535/550)
|
||
# 构建失败时改:--build-arg NVIDIA_UTILS_MAJOR=550
|
||
ARG NVIDIA_UTILS_MAJOR=535
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
"nvidia-utils-${NVIDIA_UTILS_MAJOR}" \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
RUN mkdir -p /etc/apt/keyrings \
|
||
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
||
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
|
||
&& apt-get update && apt-get install -y --no-install-recommends nodejs \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
|
||
|
||
# 安装 Miniforge + pythonocc-core(conda-forge,无 Anaconda ToS 限制)
|
||
ARG MINIFORGE_URL=https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
|
||
RUN set -eux \
|
||
&& curl -fsSL "${MINIFORGE_URL}" -o /tmp/miniforge.sh \
|
||
&& bash /tmp/miniforge.sh -b -p /opt/conda \
|
||
&& rm /tmp/miniforge.sh \
|
||
&& /opt/conda/bin/conda install -y -n base -c conda-forge \
|
||
"python=3.10" pythonocc-core=7.9.3 \
|
||
&& /opt/conda/bin/conda clean -afy \
|
||
&& ln -sf /opt/conda/lib/python3.10/site-packages/OCC \
|
||
/usr/local/lib/python3.10/dist-packages/OCC
|
||
# conda-forge 编译的 .so 需要新版 libstdc++(CXXABI_1.3.15);
|
||
# 动态查找 conda 提供的最新真实文件,避免硬编码版本号或双重软链问题
|
||
RUN set -eux \
|
||
&& LIBSTDCPP=$(ls /opt/conda/lib/libstdc++.so.6.0.* 2>/dev/null | sort -V | tail -1) \
|
||
&& [ -n "$LIBSTDCPP" ] \
|
||
&& ln -sf "$LIBSTDCPP" /usr/lib/x86_64-linux-gnu/libstdc++.so.6 \
|
||
&& echo "libstdc++ -> $LIBSTDCPP" \
|
||
&& python3 -c "from OCC.Core.STEPControl import STEPControl_Reader; print('pythonocc-core OK')" \
|
||
&& python3 -c "from OCC.Core.BRep import BRep_Builder; print('OCC BRep OK')"
|
||
|
||
# cadquery(与 Dockerfile.dev 一致)
|
||
ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||
ARG PIP_DEFAULT_TIMEOUT=300
|
||
COPY requirements-geometry.txt /tmp/requirements-geometry.txt
|
||
RUN python3 -m pip install --no-cache-dir --break-system-packages \
|
||
--default-timeout="${PIP_DEFAULT_TIMEOUT}" \
|
||
--retries 10 \
|
||
-i "${PIP_INDEX_URL}" \
|
||
-r /tmp/requirements-geometry.txt \
|
||
&& rm /tmp/requirements-geometry.txt \
|
||
&& python3 -c "import cadquery; print('cadquery OK')"
|
||
|
||
# PyTorch CUDA 12.1:默认官方 CDN;覆盖示例:--build-arg TORCH_INDEX_URL=https://download.pytorch.org/whl/cu121
|
||
ARG TORCH_INDEX_URL=https://download.pytorch.org/whl/cu121
|
||
RUN python3 -m pip install --no-cache-dir --break-system-packages \
|
||
--default-timeout=600 --retries 10 \
|
||
torch==2.3.1 torchvision==0.18.1 \
|
||
--index-url "${TORCH_INDEX_URL}"
|
||
|
||
# PyTorch3D 预编译轮仅 Meta 官方 CDN,无稳定国内镜像;加大超时。可本地下载 wheel 后 COPY + pip install。
|
||
RUN python3 -m pip install --no-cache-dir --break-system-packages \
|
||
--default-timeout=300 --retries 10 \
|
||
-i https://pypi.tuna.tsinghua.edu.cn/simple \
|
||
trimesh \
|
||
&& python3 -m pip install --no-cache-dir --break-system-packages \
|
||
--default-timeout=600 --retries 15 \
|
||
pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py310_cu121_pyt231/download.html
|
||
|
||
RUN python3 -c "import torch; import pytorch3d; import trimesh; print('pytorch', torch.__version__, 'pytorch3d', pytorch3d.__version__)"
|
||
|
||
WORKDIR /app
|
||
|
||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||
|
||
CMD ["node", "-e", "console.log('use docker-compose command')"]
|