Skip to content

Commit

Permalink
Use dev container setup instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Flova committed Feb 21, 2024
1 parent 0e5b566 commit ae435d9
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 207 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
FROM ros:iron

# Arguments
ARG user
ARG uid
ARG home

# Basic Utilities
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y \
Expand Down Expand Up @@ -81,27 +76,22 @@ RUN python3 -m pip install \
git+https://github.com/timonegk/colcon-notification.git@colors \
git+https://github.com/timonegk/colcon-output.git@colors

# Clone user into docker image and set up X11 sharing
RUN echo "${user}:x:${uid}:${uid}:${user},,,:${home}:/usr/bin/zsh" >> /etc/passwd \
&& echo "${user}:*::0:99999:0:::" >> /etc/shadow \
&& echo "${user}:x:${uid}:" >> /etc/group \
&& echo "${user} ALL=(ALL) NOPASSWD: ALL" >> "/etc/sudoers"
# Set zsh as default shell
SHELL ["/bin/zsh", "-c"]

# Create home directory and colcon workspace
RUN mkdir -p "${home}/colcon_ws" && chown -R "${user}:${user}" "${home}"
RUN mkdir -p "/root/colcon_ws"

# Switch to user
USER "${user}"

# Install oh-my-zsh for pretty terminal
RUN sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# Add zshrc
COPY zshrc "${home}/.zshrc"
COPY zshrc "/root/.zshrc"

# This is required for sharing Xauthority
ENV QT_X11_NO_MITSHM=1

# Switch to the workspace directory
WORKDIR "${home}/colcon_ws"
WORKDIR "/root/colcon_ws"
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "Bit-Bots Iron Dev",

"build": { "dockerfile": "Dockerfile" },

"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}",
"LIBGL_ALWAYS_SOFTWARE": "1",
"QT_X11_NO_MITSHM": "1",
"DOCKER": "1"
},

"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": { "zsh": { "path": "/bin/zsh" } }
},
"extensions": [
"ms-iot.vscode-ros"
]
}
},

"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/root/colcon_ws/src/bitbots_main",
"workspaceFolder": "/root/colcon_ws/src/bitbots_main",

"mounts": [
"type=bind,source=${localEnv:HOME},target=/srv/host_home,consistency=cached"
],

"runArgs": [
"--privileged",
"--net=host",
"--ulimit", "nofile=1024:524288",
"--device=/dev/dri:/dev/dri",
"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
"--cap-add=SYS_PTRACE",
"--security-opt", "seccomp=unconfined"
],

"postCreateCommand": "make -C $HOME/colcon_ws/src/bitbots_main install",
"postAttachCommand": "git config --global --add safe.directory '*'"
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# Create a function to update the argcomplete so tab completion works
# This needs to be called every time we source something ROS 2 related
function update_ros2_argcomplete() {
eval "$(register-python-argcomplete3 ros2)"
eval "$(register-python-argcomplete3 colcon)"
eval "$(register-python-argcomplete3 ros2)"
}

# Update the tab completion
Expand Down
85 changes: 0 additions & 85 deletions bitbots_misc/bitbots_containers/dev/README.md

This file was deleted.

17 changes: 0 additions & 17 deletions bitbots_misc/bitbots_containers/dev/build.bash

This file was deleted.

16 changes: 0 additions & 16 deletions bitbots_misc/bitbots_containers/dev/clean.bash

This file was deleted.

22 changes: 0 additions & 22 deletions bitbots_misc/bitbots_containers/dev/connect.bash

This file was deleted.

41 changes: 0 additions & 41 deletions bitbots_misc/bitbots_containers/dev/start.bash

This file was deleted.

10 changes: 0 additions & 10 deletions bitbots_misc/bitbots_containers/dev/stop.bash

This file was deleted.

0 comments on commit ae435d9

Please sign in to comment.