Skip to content

Commit 2823d0b

Browse files
authored
fixing issues with claude installation, and add automatic rosdep gathering (#20)
* fixing issues with claude installation, and add automatic rosdep gathering * docs for dev
1 parent 279d97d commit 2823d0b

File tree

3 files changed

+32
-38
lines changed

3 files changed

+32
-38
lines changed

.devcontainer/Dockerfile

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,37 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6060
# Install pre-commit
6161
RUN 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
8394
ARG USERNAME
8495
ARG USER_GID
8596
ARG 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.
103114
USER $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
106121
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc

.devcontainer/generate_devcontainer.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ cat > .devcontainer/devcontainer.json << EOF
7171
"name": "$CONTAINER_NAME",
7272
"build": {
7373
"dockerfile": "Dockerfile",
74+
"context": "..",
7475
"args": {
7576
$BUILD_ARGS
7677
}

DEVELOPING.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ This project includes VS Code dev container configurations for easy ROS2 develop
1313

1414
1. **Choose ROS distribution**:
1515
- Press `Ctrl+Shift+P` and run "Tasks: Run Task"
16-
- Select "Switch ROS Distro"
17-
- Choose from: `humble`, `iron`, `jazzy`, or `rolling`
16+
- Select "Setup Devcontainer (CPU Only)" or "Setup Devcontainer (GPU)" and follow prompts
1817

1918
2. **Rebuild and open in container**:
19+
- Press `Ctrl+Shift+P` and run "Dev Containers: Rebuild and Reopen in Container" or the other variants
2020
- The container will automatically rebuild and reopen with your selected ROS version
2121

2222
### Container Features
@@ -28,26 +28,4 @@ This project includes VS Code dev container configurations for easy ROS2 develop
2828

2929
### Common Commands
3030

31-
Inside the container:
32-
33-
```bash
34-
# Update apt
35-
sudo apt update
36-
37-
# Update rosdep
38-
rosdep update
39-
40-
# Install dependencies
41-
rosdep install --from-paths src --ignore-src -r -y
42-
43-
# Build packages
44-
colcon build
45-
46-
# Source workspace
47-
source install/setup.bash
48-
```
49-
50-
### Troubleshooting
51-
52-
- If the container fails to build, check that Docker is running
53-
- To rebuild from scratch: "Dev Containers: Rebuild Container"
31+
Inside the container, you can do ros2 commands, colcon commands, rosdep, etc.

0 commit comments

Comments
 (0)