From 40800b56b3d05c631ac3d312c798232a1e9db10c Mon Sep 17 00:00:00 2001 From: Benjamin Aarsen Date: Fri, 5 Sep 2025 15:18:31 +0200 Subject: [PATCH] Initial shared dev container --- Dockerfile | 9 +++++++ devcontainer.json | 61 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 Dockerfile create mode 100644 devcontainer.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3a68c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM osrf/ros:jazzy-desktop-full-noble + +SHELL [ "/bin/bash" , "-c" ] + +# Add sourcing ROS setup.bash to .bashrc +RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> ~/.bashrc +RUN echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.bashrc +RUN echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc +RUN echo "export _colcon_cd_root=/opt/ros/jazzy/" >> ~/.bashrc \ No newline at end of file diff --git a/devcontainer.json b/devcontainer.json new file mode 100644 index 0000000..ac5fd87 --- /dev/null +++ b/devcontainer.json @@ -0,0 +1,61 @@ +{ + "name": "osrf/ros:jazzy-desktop-full-noble", + "build": { + "dockerfile": "Dockerfile" + }, + "runArgs": [ + // "--cap-add=SYS_PTRACE", // Allows the container to trace processes using ptrace system call + // "--security-opt=seccomp=unconfined", // Disables seccomp security profiles for the container + // "--ipc=host", // Shares the host's IPC namespace with the container + "--network=host" // Shares the host's network namespace with the container + // "--pid=host", // Shares the host's PID namespace with the container + // "--privileged", // Gives the container full access to the host's devices and allows it to run with root privileges + ], + "workspaceMount": "source=${localWorkspaceFolder},target=/${localWorkspaceFolderBasename},type=bind", + "workspaceFolder": "/${localWorkspaceFolderBasename}", + // for linux + "containerEnv": { + // Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools + "DISPLAY": "${localEnv:DISPLAY}", + "TZ": "Europe/Amsterdam" + }, + "mounts": [ + // Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools + { + "source": "/tmp/.X11-unix", + "target": "/tmp/.X11-unix", + "type": "bind" + }, + // Uncomment to persist bash history between sessions + { + "source": "${localEnv:HOME}${localEnv:USERPROFILE}/.bash_history", + "target": "/root/.bash_history", + "type": "bind" + }, + // add dri3 + { + "source": "/dev/dri", + "target": "/dev/dri", + "type": "bind" + } + ], + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "albert.tabout", + "eamodio.gitlens", + "donjayamanne.githistory", + "ms-python.vscode-pylance", + "ms-python.python", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ranch-hand-robotics.rde-pack", + "nonanonno.vscode-ros2" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": {} + } +} \ No newline at end of file