feat: initial commit - massive-cloud point cloud processing system
This commit is contained in:
59
docker/Dockerfile.dev
Normal file
59
docker/Dockerfile.dev
Normal file
@@ -0,0 +1,59 @@
|
||||
# 开发镜像(仅 CPU,体积小):Node 22 + Python 3 + cadquery
|
||||
# 需要 Docker 内装配检测 GPU 时改用 docker/Dockerfile.dev.gpu(见 docker-compose.dev.yml)
|
||||
# 使用 glibc(bookworm),便于 cadquery / OCP 的 manylinux 轮子
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
# cadquery/OCP 会链接 OpenGL 与 X11 客户端库(无显示器也会加载),slim 需一次性装齐
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 \
|
||||
python3-pip \
|
||||
ca-certificates \
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
libxrender1 \
|
||||
libxext6 \
|
||||
libsm6 \
|
||||
libice6 \
|
||||
libx11-6 \
|
||||
libgomp1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 安装 Miniforge(conda-forge 原生,无 Anaconda ToS 限制)用于 pythonocc-core
|
||||
ARG CONDA_INSTALLER_URL=https://mirrors.tuna.tsinghua.edu.cn/github-release/conda-forge/miniforge/LatestRelease/Miniforge3-Linux-x86_64.sh
|
||||
RUN curl -fsSL "${CONDA_INSTALLER_URL}" -o /tmp/miniforge.sh \
|
||||
&& bash /tmp/miniforge.sh -b -p /opt/conda \
|
||||
&& rm /tmp/miniforge.sh \
|
||||
&& PY_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") \
|
||||
&& /opt/conda/bin/conda config --set channel_priority strict \
|
||||
&& /opt/conda/bin/conda create -y -n occ python="${PY_VER}" pythonocc-core=7.9.3 -c conda-forge \
|
||||
&& /opt/conda/bin/conda clean -afy
|
||||
# 让系统 python3 能找到 pythonocc-core(软链 site-packages)
|
||||
RUN PY_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") \
|
||||
&& CONDA_SP="/opt/conda/envs/occ/lib/python${PY_VER}/site-packages" \
|
||||
&& SYS_SP=$(python3 -c "import site; print(site.getsitepackages()[0])") \
|
||||
&& ln -sf "${CONDA_SP}/OCC" "${SYS_SP}/OCC"
|
||||
|
||||
# 先安装几何依赖(镜像构建时固化,避免每次 compose up 再 pip)
|
||||
# cadquery-ocp 轮子约 70MB,默认 pip 超时过短会 Read timed out;可调大 PIP_DEFAULT_TIMEOUT
|
||||
# 默认国内 PyPI 源;覆盖示例:--build-arg PIP_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/
|
||||
ARG PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
ARG PIP_DEFAULT_TIMEOUT=300
|
||||
COPY requirements-geometry.txt /tmp/requirements-geometry.txt
|
||||
# 必须用 python3 -m pip,避免 pip3 与 /usr/bin/python3 不是同一套 site-packages(PEP 668 下常见踩坑)
|
||||
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:', cadquery.__file__)"
|
||||
|
||||
# Node 子进程解析 STEP 时使用;与 compose 中 PYTHON3_PATH 一致,避免仅 build 镜像未带 compose 时未设置
|
||||
ENV PYTHON3_PATH=/usr/bin/python3
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
|
||||
# 默认占位;docker-compose.dev.yml 会覆盖为 pnpm dev
|
||||
CMD ["node", "-e", "console.log('use docker-compose command')"]
|
||||
Reference in New Issue
Block a user