Initial commit
This commit is contained in:
43
docker/Dockerfile.dev
Executable file
43
docker/Dockerfile.dev
Executable file
@@ -0,0 +1,43 @@
|
||||
# 开发镜像(仅 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 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 先安装几何依赖(镜像构建时固化,避免每次 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