From 689041f49c33a0869798197b6082203ffb8d99a9 Mon Sep 17 00:00:00 2001 From: Andres Montano <andres.montano@tecnalia.com> Date: Thu, 7 Nov 2024 17:56:43 +0100 Subject: [PATCH] WIP save working configs --- config/.devcontainer/Dockerfile.bk | 40 ++++++++ config/.devcontainer/devcontainer.json.bk | 115 ++++++++++++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 config/.devcontainer/Dockerfile.bk create mode 100644 config/.devcontainer/devcontainer.json.bk diff --git a/config/.devcontainer/Dockerfile.bk b/config/.devcontainer/Dockerfile.bk new file mode 100644 index 0000000..0ea7da8 --- /dev/null +++ b/config/.devcontainer/Dockerfile.bk @@ -0,0 +1,40 @@ +ARG ROS_DISTRO +ARG IMAGE_BASE +FROM ${IMAGE_BASE}:${ROS_DISTRO} +ARG USERNAME=USERNAME +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# 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 + +# 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 \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /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 + +# Set the shell by dafault +ARG SHELL=/bin/zsh +ENV SHELL ${SHELL} +ENV USER $USERNAME + +# [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 + +# ******************************************************** +# * Anything else you want to do like clean up goes here * +# ******************************************************** + +CMD ["/bin/zsh"] \ No newline at end of file diff --git a/config/.devcontainer/devcontainer.json.bk b/config/.devcontainer/devcontainer.json.bk new file mode 100644 index 0000000..8315586 --- /dev/null +++ b/config/.devcontainer/devcontainer.json.bk @@ -0,0 +1,115 @@ +{ + "name": "ROS2 Development", + "privileged": true, + "remoteUser": "${env:USERNAME}", + // Name of the dockerfile used to generate the image, alternatively a given image could be use by "image" parameter, e.g. "image":"devenv:humble" + "build": { + "dockerfile": "Dockerfile", + "args": { + "IMAGE_BASE": "${env:IMAGE_BASE}", + "ROS_DISTRO": "${env:ROS_DISTRO}", + "SHELL": "${env:SHELL}", + "USERNAME": "${env:USERNAME}" + } + }, + "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}" + ], + // 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 + "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" + } + //*/ + ], + //"postCreateCommand": "sudo rosdep update && sudo rosdep install --from-paths src --ignore-src -y", + "postCreateCommand": "direnv allow .", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.shell.linux": "${localEnv:SHELL}" + }, + "extensions": [ + // "aaron-bond.better-comments", + // "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-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", + "theumletteam.umlet", + "twxs.cmake", + // "visualstudioexptteam.intellicode-api-usage-examples", + // "visualstudioexptteam.vscodeintellicode", + "vscode-icons-team.vscode-icons", + // "ziyasal.vscode-open-in-github" + ] + } + } +} \ No newline at end of file -- GitLab