Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 28 additions & 13 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,26 +60,37 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Install pre-commit
RUN python3 -m pip install --no-cache-dir pre-commit==3.8.0

# Install Node.js 20 LTS (required for Claude Code)
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
# Set working dir (matches VSCode workspace)
WORKDIR /deep_ros_ws

# Install Claude Code CLI via npm
# hadolint ignore=DL3016
RUN npm install -g @anthropic-ai/claude-code
# ===============================================
# Gather Dependencies
# ===============================================
FROM dev-tools AS source

# Initialize rosdep
RUN rosdep init || true
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN --mount=type=bind,source=.,target=/tmp/src \
apt-get -qq update && rosdep update && \
rosdep install --from-paths /tmp/src --ignore-src -r -s \
| (grep 'apt-get install' || true) \
| awk '{print $3}' \
| sort > /tmp/colcon_install_list

# Set working dir (matches VSCode workspace)
WORKDIR /deep_ros_ws
# ===============================================
# Install Dependencies
# ===============================================
FROM dev-tools AS dependencies

# Install Rosdep requirements
COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list
RUN apt-get update && \
xargs -a /tmp/colcon_install_list apt-get install -qq -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/*

# ===============================================
# Add User Configuration
# ===============================================
FROM dev-tools as user-conf
FROM dependencies AS user-conf
ARG USERNAME
ARG USER_GID
ARG USER_UID
Expand All @@ -102,5 +113,9 @@ RUN groupadd --gid ${USER_GID} ${USERNAME} \
# Set the default user. Omit if you want to keep the default as root.
USER $USERNAME

# Install Claude Code natively
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -fsSL https://claude.ai/install.sh | bash

# Source ROS in user's bashrc
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc
1 change: 1 addition & 0 deletions .devcontainer/generate_devcontainer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ cat > .devcontainer/devcontainer.json << EOF
"name": "$CONTAINER_NAME",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
$BUILD_ARGS
}
Expand Down
28 changes: 3 additions & 25 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ This project includes VS Code dev container configurations for easy ROS2 develop

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

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

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

### Common Commands

Inside the container:

```bash
# Update apt
sudo apt update

# Update rosdep
rosdep update

# Install dependencies
rosdep install --from-paths src --ignore-src -r -y

# Build packages
colcon build

# Source workspace
source install/setup.bash
```

### Troubleshooting

- If the container fails to build, check that Docker is running
- To rebuild from scratch: "Dev Containers: Rebuild Container"
Inside the container, you can do ros2 commands, colcon commands, rosdep, etc.