forked from zkytony/robotdev
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
we ARE going to use Docker with Spot
- Loading branch information
Showing
3 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# This image allows you to have a Ubuntu 20.04 + ROS Noetic setup. | ||
# You can mount the path to the 'robotdev' repository in your host | ||
# machine to the same path in the container. We ask you to use the | ||
# same username in the container as in your host machine. This | ||
# simplifies the maintenance of the 'robotdev' repository. | ||
# This setup relies on the nice ros:noetic image provided | ||
# on Docker Hub. | ||
# /author: Kaiyu Zheng | ||
FROM ros:noetic | ||
|
||
# Install software | ||
RUN apt-get update | ||
RUN apt-get install -y --no-install-recommends apt-utils | ||
RUN apt-get install -y emacs | ||
RUN apt-get install -y sudo | ||
RUN apt-get install -y python-pip | ||
RUN apt-get install -y net-tools | ||
RUN apt-get install -y iputils-ping | ||
RUN apt-get install -y gdb | ||
RUN apt-get install -y mlocate | ||
RUN apt-get install -y openssh-client openssh-server | ||
RUN apt-get install -y ros-noetic-desktop-full | ||
RUN apt-get install -y ros-noetic-rviz-imu-plugin | ||
|
||
|
||
# create a user | ||
ARG hostuser=kaiyu | ||
|
||
RUN adduser --disabled-password --gecos '' $hostuser | ||
RUN adduser $hostuser sudo | ||
# Ensure sudo group users are not asked for a p3assword when using sudo command | ||
# by ammending sudoers file | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> \ | ||
/etc/sudoers | ||
|
||
USER $hostuser | ||
WORKDIR /home/$hostuser | ||
ENV HOME=/home/$hostuser | ||
RUN mkdir $HOME/repo | ||
|
||
# Different shell color | ||
RUN echo "export PS1='\e[33;1m\u@\h:\e[31m\w\e[0m\$ '" >> $HOME/.bashrc | ||
|
||
# print some info on start | ||
RUN echo "echo -e 'Welcome! You are now in a docker container ().'" >> $HOME/.bashrc | ||
RUN echo "echo -e \"Docker ID: $(basename $(cat /proc/1/cpuset))\"" >> $HOME/.bashrc | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Make sure we are in the right directory. | ||
# the rest of the script assumes we are in robotdev/docker | ||
if [[ $PWD = *robotdev ]]; then | ||
cd docker | ||
elif [[ ! $PWD = *robotdev/docker ]]; then | ||
echo -e "You must be in either 'robotdev' or the 'robotdev/docker' directory to run this command." | ||
return 1 | ||
fi | ||
|
||
# load tools | ||
. "../tools.sh" | ||
|
||
# parse args | ||
hostuser=$USER # the user inside the container | ||
nvidia="" | ||
for arg in "$@" | ||
do | ||
if parse_var_arg arg; then | ||
if [[ $var_name = "hostuser" ]]; then | ||
hostuser=$var_value | ||
else | ||
echo -e "Unrecognized argument variable: ${var_name}" | ||
fi | ||
elif is_flag arg; then | ||
# we are not there yet (with nvidia) | ||
# if [[ $arg = "--nvidia" ]]; then | ||
# nvidia=".nvidia" | ||
# fi | ||
echo "unhandled arg: $arg" | ||
fi | ||
done | ||
|
||
# Build the docker image. The `--rm` option is for you to more conveniently | ||
# rebuild the image. | ||
cd $PWD/../ # get to the root of the repository | ||
docker build -f Dockerfile.noetic${nvidia}\ | ||
-t robotdev:noetic\ | ||
--build-arg hostuser=$hostuser\ | ||
--rm\ | ||
. | ||
# Explain the options above: | ||
# -t: tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters