@@ -373,23 +373,10 @@ RUN /bin/bash -c "source /opt/ros/humble/setup.bash && \
373373 colcon build --packages-select gz_ros2_control --allow-overriding gz_ros2_control"
374374WORKDIR /
375375
376- # ==========================================================================
377- # deps-final — Session B: fresh runtime install + explicit artifact COPYs.
378- #
379- # The blanket `COPY --from=deps-builder / /` is GONE. Instead this stage
380- # fresh-installs its package set and copies over only the artifacts that
381- # apt/pip did not produce (git clones, .deb-installed binaries, config
382- # writes, and the two ROS workspaces).
383- #
384- # Toolchain policy (mentor ruling, Session B): the ROS build toolchain is
385- # RETAINED here on purpose. Dockerfile.humble is built FROM this image and
386- # runs `colcon build` in /home/ws (line ~68), compiling the CustomRobots /
387- # jderobot_drones / Industrial packages moved in from RoboticsInfrastructure.
388- # Stripping build-essential/cmake/colcon/ament-cmake/rosidl-generators/-dev
389- # headers would break that child build. Only unambiguously-safe packages are
390- # dropped: editors (vim/nano), coverage/lint tooling, and firmware-only pip.
391- # See audit.md for the full DROP/KEEP/VERIFY classification and rationale.
392- # ==========================================================================
376+ # Runtime stage: fresh-installs its own packages instead of copying the
377+ # builder's rootfs wholesale. Build toolchain (cmake/colcon/etc.) is kept
378+ # since Dockerfile.humble runs colcon build on top of this image. See
379+ # audit.md for the full package DROP/KEEP rationale.
393380FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu22.04 AS deps-final
394381
395382# Make all NVIDIA GPUS visible
@@ -421,32 +408,19 @@ ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
421408# VirtualGL + TurboVNC on PATH
422409ENV PATH="$PATH:/opt/VirtualGL/bin:/opt/TurboVNC/bin"
423410
424- # --------------------------------------------------------------------------
425- # 1. Apt repo configs + keyrings from the builder so a fresh apt-get update
426- # can resolve the ROS 2, Gazebo (OSRF) and PostgreSQL (PGDG) repositories.
427- # These are "config writes", not apt/pip packages, so they are copied.
428- # (ca-certificates is installed in the apt block below; the base image
429- # already ships certs, so the first https fetch against these repos works.)
430- # --------------------------------------------------------------------------
411+ # Repo keyrings/sources from the builder so apt-get update can resolve
412+ # the ROS 2/Gazebo/PGDG repos here too.
431413COPY --from=deps-builder /usr/share/keyrings/ /usr/share/keyrings/
432414COPY --from=deps-builder /etc/apt/sources.list.d/ /etc/apt/sources.list.d/
433415
434- # --------------------------------------------------------------------------
435- # 2. Locale (own layer: needs locale-gen after installing the locales pkg).
436- # --------------------------------------------------------------------------
416+ # Locale needs its own layer since locale-gen runs after install.
437417RUN apt-get update && apt-get install -y --no-install-recommends locales \
438418 && locale-gen en_US.UTF-8 \
439419 && rm -rf /var/lib/apt/lists/*
440420
441- # --------------------------------------------------------------------------
442- # 3. Single runtime apt block — KEEP + build toolchain (see policy above),
443- # with i386 enabled for the 32-bit VirtualGL GL stack. DROPPED vs builder:
444- # bash-completion, vim, nano, sudo-NO(kept, see audit), software-properties-
445- # common, python3-rosdep, python3-vcstool, python3-argcomplete,
446- # python3-colcon-mixin, python3-flake8*, cppcheck, lcov, python3-pytest,
447- # ros-humble-ament-{cmake-gtest,cmake-lint-cmake,cmake-pytest,cmake-xmllint,
448- # copyright,flake8,lint-auto,lint-common,pep257}, ros-humble-ros-testing.
449- # --------------------------------------------------------------------------
421+ # Runtime apt packages (build toolchain kept, see above). i386 enabled for
422+ # the 32-bit VirtualGL stack. Editors/lint/test-only packages dropped vs
423+ # the builder — see audit.md for the full list.
450424RUN dpkg --add-architecture i386 \
451425 && apt-get update && apt-get install -y --no-install-recommends \
452426 apt-utils \
@@ -540,13 +514,8 @@ RUN apt-get update && \
540514 apt-get install -y lxde-common && \
541515 rm -rf /var/lib/apt/lists/*
542516
543- # --------------------------------------------------------------------------
544- # 4. Runtime pip re-install (mentor ruling: re-install, do NOT copy site-
545- # packages). Mirrors the builder's pip blocks minus firmware/test/lint-only
546- # wheels: DROPPED selenium, coverage, kconfiglib, nunavut, pyros-genmsg,
547- # flake8, pycodestyle, cmakelint, cpplint, colcon-lcov-result.
548- # KEPT pylint/jedi/black — declared runtime deps in RAM's pyproject.toml.
549- # --------------------------------------------------------------------------
517+ # Re-install pip packages fresh rather than copying site-packages. Mirrors
518+ # the builder's pip blocks minus test/lint/firmware-only wheels — see audit.md.
550519RUN python3.10 -m pip install --no-cache-dir --upgrade pip==23.3.1 wheel==0.41.3 setuptools==69.0.2
551520
552521RUN python3.10 -m pip install --no-cache-dir \
@@ -556,8 +525,7 @@ RUN python3.10 -m pip install --no-cache-dir \
556525 pyulog==1.0.1 pyyaml==5.4.1 requests==2.31.0 serial==0.0.97 six==1.16.0 toml==0.10.2 psutil==5.9.0 \
557526 onnxruntime-gpu==1.22.0 Pillow==9.0.1 opencv-python==4.5.5.64 watchdog==2.1.5 utm==0.7.0 psycopg2 jedi pyapriltags
558527
559- # CUDA runtime wheels for onnxruntime-gpu CUDA EP (see builder stage for the
560- # version-lock rationale — keep in lockstep with the builder block).
528+ # CUDA runtime wheels for onnxruntime-gpu — keep versions in lockstep with the builder block.
561529RUN python3.10 -m pip install --no-cache-dir \
562530 nvidia-cuda-runtime-cu12==12.8.90 \
563531 nvidia-cublas-cu12==12.8.4.1 \
@@ -578,17 +546,12 @@ RUN python3.10 -m pip install --no-cache-dir black==24.10.0
578546RUN python3.10 -m pip install --no-cache-dir websocket_server==0.6.4 posix-ipc==1.1.1 django==4.1.7 djangorestframework==3.13.1 \
579547 django-webpack-loader==1.5.0 django-cors-headers==3.14.0 websockets==11.0.3 asyncio==3.4.3
580548
581- # BT studio + drone runtime pip (lint/coverage wheels from this builder block
582- # dropped; transforms3d + PySimpleGUI kept for the drone/teleop runtime).
549+ # BT studio + drone runtime pip (transforms3d/PySimpleGUI for teleop).
583550RUN python3.10 -m pip install --no-cache-dir py-trees autopep8 transforms3d PySimpleGUI-4-foss
584551
585- # --------------------------------------------------------------------------
586- # 5. Non-apt/pip artifacts from the builder (git clones, .deb-installed
587- # binaries, downloaded files, config writes). These replace what the old
588- # blanket `COPY / /` used to drag across.
589- # --------------------------------------------------------------------------
590- # VirtualGL + TurboVNC (installed from .deb; the .deb files were removed in
591- # the builder, so the installed trees + setuid faker libs are copied instead).
552+ # Non-apt/pip artifacts from the builder (git clones, .deb binaries, config
553+ # writes) — replaces the old blanket `COPY / /`.
554+ # VirtualGL + TurboVNC install trees + setuid faker libs (.deb already removed in the builder).
592555COPY --from=deps-builder /opt/VirtualGL /opt/VirtualGL
593556COPY --from=deps-builder /opt/TurboVNC /opt/TurboVNC
594557COPY --from=deps-builder /usr/lib/libvglfaker.so /usr/lib/libvglfaker.so
@@ -604,14 +567,10 @@ COPY --from=deps-builder /noVNC /noVNC
604567# Downloaded X config
605568COPY --from=deps-builder /xorg.conf /xorg.conf
606569
607- # OMPL + onnxruntime C++ API — the ONLY genuinely non-reinstalled content
608- # under the builder's /usr/local (everything else there is pip
609- # dist-packages, already covered fresh by the RUN blocks in section 4
610- # above). Scoped explicitly instead of a blanket `COPY /usr/local/
611- # /usr/local/`, which used to duplicate ~3.5GB of already-reinstalled pip
612- # packages on top of itself (confirmed via `docker history` + `dive`;
613- # see scripts/RADI/size-regression-rootcause.md). Paths verified against
614- # the actual built image, not guessed.
570+ # OMPL + onnxruntime C++ API — the only non-pip content left under
571+ # /usr/local. Scoped explicitly instead of `COPY /usr/local/ /usr/local/`,
572+ # which duplicated ~3.5GB of already-reinstalled pip packages (see
573+ # size-regression-rootcause.md).
615574COPY --from=deps-builder /usr/local/lib/libompl.so* /usr/local/lib/
616575COPY --from=deps-builder /usr/local/lib/libonnxruntime* /usr/local/lib/
617576COPY --from=deps-builder /usr/local/lib/cmake/ /usr/local/lib/cmake/
@@ -629,7 +588,7 @@ RUN ldconfig
629588# Shell env writes (RMW impl, ROS/aerostack2 sourcing) — root's .bashrc
630589COPY --from=deps-builder /root/.bashrc /root/.bashrc
631590
632- # ROS workspaces — WHOLESALE per mentor ruling (install/ + src/, no subsetting)
591+ # ROS workspaces copied wholesale (install/ + src/, no subsetting).
633592COPY --from=deps-builder /home/ws /home/ws
634593COPY --from=deps-builder /home/drones_ws /home/drones_ws
635594
0 commit comments