Skip to content

Commit

Permalink
Further improvements for docker Dev environment
Browse files Browse the repository at this point in the history
1. Add sudo support for the user
2. Add setup.bash to bashrc
3. Add cpp-tools-extension-pack vscode extension
4. Switch to host networking mode
  • Loading branch information
jeremysalwen committed Aug 11, 2024
1 parent 1d9fe79 commit 671c109
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
"ms-azuretools.vscode-docker",
"ms-python.python",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"ms-iot.vscode-ros"
]
}
},
"remoteUser": "dev"
"remoteUser": "dev",
"postCreateCommand": "echo 'source /opt/ros/noetic/setup.bash' >> ~/.bashrc"
}
6 changes: 5 additions & 1 deletion devenv/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ RUN groupadd -g ${MY_GID} -o ${MY_USER}
# Create a new user, assign it to the group, and set its shell to bash
RUN useradd -m -u ${MY_UID} -g ${MY_GID} -o -s /bin/bash ${MY_USER} && yes ${MY_USER} | passwd ${MY_USER}

RUN echo $MY_USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$MY_USER \
&& chmod 0440 /etc/sudoers.d/$MY_USER

RUN apt-get update && apt-get install -y zsh git sudo ssh gdb rsync
RUN echo "$MY_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

RUN ( \
echo 'LogLevel DEBUG2'; \
Expand All @@ -22,6 +24,8 @@ RUN ( \
&& mkdir /run/sshd
RUN bash -c "ssh-keygen -A"

RUN echo "$MY_USER ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

# Update rosdep package manager for ROS
RUN rosdep update --rosdistro $ROS_DISTRO

Expand Down

0 comments on commit 671c109

Please sign in to comment.