diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..cd14acf935853d62c1f53fa9f23e9952107f8ded --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM osrf/ros:melodic-desktop-full-bionic + +ARG uid=1000 +ARG gid=1000 + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENV USERNAME ros +RUN useradd -m $USERNAME && \ + echo "$USERNAME:$USERNAME" | chpasswd && \ + usermod --shell /bin/bash $USERNAME && \ + usermod -aG sudo $USERNAME && \ + echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \ + chmod 0440 /etc/sudoers.d/$USERNAME && \ + # Replace 1000 with your user/group id + usermod --uid $uid $USERNAME && \ + groupmod --gid $gid $USERNAME + +RUN apt-get update && apt-get install -y \ + python-catkin-tools bash +WORKDIR /home/$USERNAME +COPY src /home/$USERNAME/src +RUN rosdep install --from-paths . -r -y +RUN catkin config \ + --extend /opt/ros/melodic && \ + catkin build + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md index afa25cbdd3ec00b7b64fa851edde01b2c72ad86e..17a7ae6d1a0182005cdf01fffa65091f5c573a53 100644 --- a/README.md +++ b/README.md @@ -44,5 +44,11 @@ See the [README.md of the submodule](../../../../sample_applications/-/blob/mast - Execution of a simple motion costraint by a blocking object: `roslaunch sample_applications sample_constraint_simulation.launch` - Execution of a velocity constraint cartesian trajectory: `roslaunch sample_applications simulation.launch` +## Docker +To run via docker on any up-to-date linux system: +- Clone this repo and its submodules (recommended for fresh installations): + - as a guest: `git clone --recurse-submodules https://git-st.inf.tu-dresden.de/ceti/ros/panda_gazebo_workspace.git panda_gazebo_workspace` + - as a project member with a registered ssh key: `git clone --recurse-submodules git@git-st.inf.tu-dresden.de:ceti/ros/panda_gazebo_workspace.git panda_gazebo_workspace` +- Run `./docker-run.sh roslaunch sample_applications sample_simple_simulation.launch` to build and run a docker image tagged with `ceti-panda-gazebo-workspace` \ No newline at end of file diff --git a/docker-run.sh b/docker-run.sh new file mode 100755 index 0000000000000000000000000000000000000000..a53368027d31bcd98a437b0df6c52ec89968d23a --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# http://wiki.ros.org/docker/Tutorials/GUI + +docker build . -t ceti-panda-gazebo-workspace \ + --build-arg UID=$UID \ + --build-arg GID=$GID + +XSOCK=/tmp/.X11-unix +XAUTH=/tmp/.docker.xauth +touch $XAUTH +xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - + +docker run -it \ + --volume=$XSOCK:$XSOCK:rw \ + --volume=$XAUTH:$XAUTH:rw \ + --env="XAUTHORITY=${XAUTH}" \ + --env="DISPLAY" \ + --device=/dev/dri \ + --group-add video \ + --user="ros" \ + ceti-panda-gazebo-workspace \ + "$@" \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..527ef79f97e119b848d1817fcec54f9bc4be1227 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/bash +source /opt/ros/melodic/setup.bash +source $HOME/devel/setup.bash +exec "$@" \ No newline at end of file