@@ -60,26 +60,37 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6060# Install pre-commit
6161RUN python3 -m pip install --no-cache-dir pre-commit==3.8.0
6262
63- # Install Node.js 20 LTS (required for Claude Code)
64- SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
65- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
66- apt-get install -y --no-install-recommends nodejs && \
67- rm -rf /var/lib/apt/lists/*
63+ # Set working dir (matches VSCode workspace)
64+ WORKDIR /deep_ros_ws
6865
69- # Install Claude Code CLI via npm
70- # hadolint ignore=DL3016
71- RUN npm install -g @anthropic-ai/claude-code
66+ # ===============================================
67+ # Gather Dependencies
68+ # ===============================================
69+ FROM dev-tools AS source
7270
73- # Initialize rosdep
74- RUN rosdep init || true
71+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
72+ RUN --mount=type=bind,source=.,target=/tmp/src \
73+ apt-get -qq update && rosdep update && \
74+ rosdep install --from-paths /tmp/src --ignore-src -r -s \
75+ | (grep 'apt-get install' || true) \
76+ | awk '{print $3}' \
77+ | sort > /tmp/colcon_install_list
7578
76- # Set working dir (matches VSCode workspace)
77- WORKDIR /deep_ros_ws
79+ # ===============================================
80+ # Install Dependencies
81+ # ===============================================
82+ FROM dev-tools AS dependencies
83+
84+ # Install Rosdep requirements
85+ COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list
86+ RUN apt-get update && \
87+ xargs -a /tmp/colcon_install_list apt-get install -qq -y --no-install-recommends && \
88+ rm -rf /var/lib/apt/lists/*
7889
7990# ===============================================
8091# Add User Configuration
8192# ===============================================
82- FROM dev-tools as user-conf
93+ FROM dependencies AS user-conf
8394ARG USERNAME
8495ARG USER_GID
8596ARG USER_UID
@@ -102,5 +113,9 @@ RUN groupadd --gid ${USER_GID} ${USERNAME} \
102113# Set the default user. Omit if you want to keep the default as root.
103114USER $USERNAME
104115
116+ # Install Claude Code natively
117+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
118+ RUN curl -fsSL https://claude.ai/install.sh | bash
119+
105120# Source ROS in user's bashrc
106121RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc
0 commit comments