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

Fix devcontainer base files

parent fed5e13c
Branches
No related tags found
No related merge requests found
ARG ROS_DISTRO
ARG IMAGE_BASE
FROM ${IMAGE_BASE}:${ROS_DISTRO}
FROM devenv:humble
ARG USERNAME=USERNAME
ARG USER_UID=1000
ARG USER_GID=$USER_UID
......@@ -11,6 +9,7 @@ RUN if id -u $USER_UID ; then userdel `id -un $USER_UID` ; fi
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
......@@ -18,21 +17,12 @@ RUN groupadd --gid $USER_GID $USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y python3-pip
# Set the shell by dafault
ARG SHELL=/bin/zsh
ENV SHELL ${SHELL}
# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME
# [Optional] Clone dotfiles and apply configuration
RUN git clone https://github.com/andsens/homeshick.git /home/$USERNAME/.homesick/repos/homeshick \
&& /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick clone anfemosa/dotfiles \
&& /home/$USERNAME/.homesick/repos/homeshick/bin/homeshick link dotfiles
ENV SHELL /bin/bash
# ********************************************************
# * Anything else you want to do like clean up goes here *
# ********************************************************
CMD ["/bin/zsh"]
\ No newline at end of file
# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME
CMD ["/bin/bash"]
{
// Name of the tool
"name": "ROS 2 Development Container",
"privileged": true,
"remoteUser": "${env:USERNAME}",
// Dockerfile used to generate the image, alternatively a given image could be use by "image" parameter, e.g. "image":"devenv:humble"
// But build and image cannot be used together
"remoteUser": "andres",
"build": {
"dockerfile": "Dockerfile",
"args": {
"IMAGE_BASE": "${env:IMAGE_BASE}",
"ROS_DISTRO": "${env:ROS_DISTRO}",
"SHELL": "${env:SHELL}",
"USERNAME": "${env:USERNAME}"
"USERNAME": "andres"
}
},
//"image": "${localEnv:IMAGE_BASE}:${localEnv:ROS_DISTRO}",
// Arguments to pass to the container. The same arguments are passed to the docker run command
"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
"--net=host",
"--pid=host",
"--ipc=host",
"--rm", // Remove the container when stop it.
"--name=${localEnv:ROS_DISTRO}" // Name of the container; useful to attache terminals to it using the dotfiles
],
// Mount the workspace
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind",
"workspaceFolder": "${localWorkspaceFolder}",
// Uncomment to allow the container to access the X server on the host e.g. to run Rviz and other GUI tools
// As rocker is not used nvidia and other features are not supported [WIP]
"containerEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
"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"
},
{
"source": "${localEnv:XAUTHORITY:-$HOME/.Xauthority}",
"target": "${localEnv:HOME}/.Xauthority",
"type": "bind"
},
// Mount the host's /dev directory allowing the container to access hardware/devices on the host
{
"source": "/dev",
"target": "/dev",
"type": "bind"
}
// [Optional] Mount bash history
,
{
"source": "${localEnv:HOME}/.bash_eternal_history",
"target": "${localEnv:HOME}/.bash_eternal_history",
"type": "bind"
}
//*/
],
// Commands to run after creating the container
//"postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y",
"postCreateCommand": "direnv allow .",
// VS Code settings
"workspaceFolder": "/home/ws",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ws,type=bind",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "${localEnv:SHELL}"
},
"extensions":[
"aaron-bond.better-comments",
"alefragnani.project-manager",
"cheshirekow.cmake-format",
"codeium.codeium",
"codezombiech.gitignore",
"eamodio.gitlens",
"github.github-vscode-theme",
"hbenl.vscode-test-explorer",
"jeff-hykin.better-cpp-syntax",
"josetr.cmake-language-support-vscode",
"kaih2o.python-resource-monitor",
"kevinrose.vsc-python-indent",
"llvm-vs-code-extensions.vscode-clangd",
"mhutchie.git-graph",
"mintlify.document",
"ms-azuretools.vscode-docker",
"ms-dotnettools.vscode-dotnet-runtime",
"ms-iot.vscode-ros",
"ms-python.autopep8",
"ms-python.black-formatter",
"ms-python.debugpy",
"ms-python.flake8",
"ms-python.isort",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-toolsai.jupyter-keymap",
"ms-vscode-remote.remote-containers",
"ms-vscode-remote.remote-ssh-edit",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-wsl",
"ms-vscode-remote.vscode-remote-extensionpack",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack",
"ms-vscode.cpptools-themes",
"ms-vscode.cpptools",
"ms-vscode.remote-explorer",
"ms-vscode.remote-server",
"ms-vscode.test-adapter-converter",
"njpwerner.autodocstring",
"njqdev.vscode-python-typehint",
"oderwat.indent-rainbow",
"slevesque.vscode-3dviewer",
"streetsidesoftware.code-spell-checker",
"theumletteam.umlet",
"trabpukcip.wolf",
"ms-vscode.cpptools-themes",
"twxs.cmake",
"visualstudioexptteam.intellicode-api-usage-examples",
"visualstudioexptteam.vscodeintellicode",
"vscode-icons-team.vscode-icons",
"xirider.livecode",
"yzane.markdown-pdf",
"ziyasal.vscode-open-in-github"
"donjayamanne.python-extension-pack",
"eamodio.gitlens",
"ms-iot.vscode-ros"
]
}
}
},
"containerEnv": {
"DISPLAY": "unix:0",
"ROS_AUTOMATIC_DISCOVERY_RANGE": "LOCALHOST",
// "ROS_DOMAIN_ID": "42"
},
"runArgs": [
"--net=host",
"--pid=host",
"--ipc=host",
"-e", "DISPLAY=${env:DISPLAY}",
"--name=humble"
],
"mounts": [
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,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/"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment