Skip to content
Snippets Groups Projects
Commit 830996b0 authored by Montaño Sarria, Andres Felipe's avatar Montaño Sarria, Andres Felipe
Browse files

Add functional devcontainer and dockerfile (neurondones)

parent faddc7e7
No related branches found
No related tags found
No related merge requests found
FROM devenv:humble FROM neurondones:humble
ARG USERNAME=USERNAME ARG USERNAME=USERNAME
ARG USER_UID=1000 ARG USER_UID=1000
ARG USER_GID=$USER_UID ARG USER_GID=$USER_UID
ARG SHELL=/bin/bash
# Delete user if it exists in container (e.g Ubuntu Noble: ubuntu) # Delete user if it exists in container (e.g Ubuntu Noble: ubuntu)
RUN if id -u $USER_UID ; then userdel `id -un $USER_UID` ; fi RUN if id -u $USER_UID ; then userdel `id -un $USER_UID` ; fi
# Create the user # Create the user
RUN groupadd --gid $USER_GID $USERNAME \ RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -ms $SHELL $USERNAME \
# #
# [Optional] Add sudo support. Omit if you don't need to install software after connecting. # [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \ && apt-get update \
&& apt-get install -y sudo \ && apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME && chmod 0440 /etc/sudoers.d/$USERNAME
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y python3-pip # [Optional] Set the default user. Omit if you want to keep the default as root.
ENV SHELL /bin/bash USER $USERNAME
ENV SHELL "${SHELL}"
# [Optional] Install additional OS packages.
WORKDIR /home/$USERNAME
# ******************************************************** # ********************************************************
# * Anything else you want to do like clean up goes here * # * Anything else you want to do like clean up goes here *
# ******************************************************** # ********************************************************
# [Optional] Set the default user. Omit if you want to keep the default as root. # [Optional] Clone dotfiles and apply configuration
USER $USERNAME # RUN git clone https://github.com/andsens/homeshick.git /home/$USERNAME/.homesick/repos/homeshick \
CMD ["/bin/bash"] # && /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick clone anfemosa/dotfiles \
# && /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick -f link dotfiles
CMD ["${SHELL}"]
...@@ -13,30 +13,34 @@ ...@@ -13,30 +13,34 @@
"customizations": { "customizations": {
"vscode": { "vscode": {
"extensions":[ "extensions":[
"ms-vscode.cpptools", "codeium.codeium",
"eamodio.gitlens",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools-themes", "ms-vscode.cpptools-themes",
"ms-vscode.cpptools",
"twxs.cmake", "twxs.cmake",
"donjayamanne.python-extension-pack",
"eamodio.gitlens",
"ms-iot.vscode-ros" "ms-iot.vscode-ros"
] ]
} }
}, },
"containerEnv": { "containerEnv": {
"DISPLAY": "unix:0", "DISPLAY": "${localEnv:DISPLAY}",
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST", "ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
// "ROS_DOMAIN_ID": "42" "ROS_LOCALHOST_ONLY": "1",
"RMW_IMPLEMENTATION": "rmw_cyclonedds_cpp"
}, },
"runArgs": [ "runArgs": [
"--net=host", "--net=host",
"--pid=host", "--pid=host",
"--ipc=host", "--ipc=host",
"-e", "DISPLAY=${env:DISPLAY}", "-e", "DISPLAY=${env:DISPLAY}",
"--name=humble" "--rm",
"--name=${env:ROS_DISTRO}"
], ],
"mounts": [ "mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached", "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
"source=/dev/dri,target=/dev/dri,type=bind,consistency=cached" "source=/dev/dri,target=/dev/dri,type=bind,consistency=cached"
], ],
"postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y || true && sudo chown -R $(whoami) /home/ws/" // "postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y || true && sudo chown -R $(whoami) /home/ws/ && direnv allow ."
"postCreateCommand": "sudo chown -R $(whoami) /home/ws/ && direnv allow ."
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment