diff --git a/README.md b/README.md index 65fa3ff6..8eedf17c 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ $ git clone https://github.com/jsk-enshu/robot-programming $ wstool init . $ wstool merge robot-programming/.rosinstall.${ROS_DISTRO} $ wstool update -$ rosdep update +$ rosdep update # If you have never run rosdep init, run `sudo rosdep init` before this command. $ cd .. $ rosdep install --from-paths src --ignore-src -y -r -$ catkin build +$ catkin build -j1 # $ echo 'source ~/catkin_ws/devel/setup.bash' >> ~/.bashrc ## > と >> の違いが理解できていればbashrcに追加してもよい ``` diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..3539c528 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,45 @@ +FROM ros:melodic-ros-core-bionic + +RUN apt -y update \ + && apt install -y \ + ros-melodic-desktop-full \ + iputils-ping \ + net-tools \ + wget \ + bash \ + fluxbox \ + git \ + net-tools \ + novnc \ + supervisor \ + fluxbox \ + x11vnc \ + xterm \ + xvfb \ + iproute2 \ + python-wstool \ + python-catkin-tools + +RUN apt -y update \ + && apt install -y \ + python-rosdep + +RUN mkdir -p /root/catkin_ws +WORKDIR /root/catkin_ws +RUN /bin/bash -c "source /opt/ros/melodic/setup.bash" +RUN echo "source /opt/ros/melodic/setup.sh" >> /root/.bashrc +WORKDIR /root/catkin_ws +ENV HOME=/root \ + DEBIAN_FRONTEND=noninteractive \ + LANG=en_US.UTF-8 \ + LANGUAGE=en_US.UTF-8 \ + LC_ALL=C.UTF-8 \ + DISPLAY=:0.0 \ + DISPLAY_WIDTH=1920 \ + DISPLAY_HEIGHT=1080 \ + RUN_XTERM=yes \ + RUN_FLUXBOX=yes \ + ROS_MASTER_URI=http://localhost:11311 +COPY . /app +CMD ["/app/entrypoint.sh"] +EXPOSE 8080 diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000..9b817450 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,30 @@ +# Dockerfile for jsk-enshu + +## For MAC-M1 user + +First, please install [Docker Desktop](https://www.docker.com/products/docker-desktop) and launch it. + +Next, clone this repository and build docker. + +``` +$ git clone https://github.com/jsk-enshu/robot-programming +$ cd robot-programming +$ git remote add iory https://github.com/iory/robot-programming +$ git fetch iory +$ git checkout -b docker iory/docker +$ cd docker +$ ./build.sh +``` + +After that, run the docker container. + +``` +$ ./run.sh +``` + +You can access inside the container by accessing the following url. + +http://localhost:8080/vnc_auto.html + +Now you can start the exercise! + diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 00000000..2efbac96 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +docker build --rm \ + -t="jsk-enshu/ros-novnc-web:latest" \ + . diff --git a/docker/conf.d/fluxbox.conf b/docker/conf.d/fluxbox.conf new file mode 100644 index 00000000..96793ad6 --- /dev/null +++ b/docker/conf.d/fluxbox.conf @@ -0,0 +1,3 @@ +[program:fluxbox] +command=fluxbox +autorestart=true diff --git a/docker/conf.d/websockify.conf b/docker/conf.d/websockify.conf new file mode 100644 index 00000000..d15418cf --- /dev/null +++ b/docker/conf.d/websockify.conf @@ -0,0 +1,3 @@ +[program:websockify] +command=websockify --web /usr/share/novnc 8080 localhost:5900 +autorestart=true diff --git a/docker/conf.d/x11vnc.conf b/docker/conf.d/x11vnc.conf new file mode 100644 index 00000000..2fff49af --- /dev/null +++ b/docker/conf.d/x11vnc.conf @@ -0,0 +1,3 @@ +[program:x11vnc] +command=x11vnc -forever -shared +autorestart=true diff --git a/docker/conf.d/xterm.conf b/docker/conf.d/xterm.conf new file mode 100644 index 00000000..da1af445 --- /dev/null +++ b/docker/conf.d/xterm.conf @@ -0,0 +1,3 @@ +[program:xterm] +command=xterm +autorestart=true diff --git a/docker/conf.d/xvfb.conf b/docker/conf.d/xvfb.conf new file mode 100644 index 00000000..29949d8e --- /dev/null +++ b/docker/conf.d/xvfb.conf @@ -0,0 +1,3 @@ +[program:xvfb] +command=Xvfb :0 -screen 0 "%(ENV_DISPLAY_WIDTH)s"x"%(ENV_DISPLAY_HEIGHT)s"x24 -listen tcp -ac +autorestart=true diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 00000000..283ca625 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -ex + +RUN_FLUXBOX=${RUN_FLUXBOX:-yes} +RUN_XTERM=${RUN_XTERM:-yes} + +case $RUN_FLUXBOX in + false|no|n|0) + rm -f /app/conf.d/fluxbox.conf + ;; +esac + +case $RUN_XTERM in + false|no|n|0) + rm -f /app/conf.d/xterm.conf + ;; +esac + +exec supervisord -c /app/supervisord.conf diff --git a/docker/run.sh b/docker/run.sh new file mode 100755 index 00000000..d16373e1 --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +docker run -it -p 8080:8080 \ + --name ros-novnc-web \ + jsk-enshu/ros-novnc-web:latest diff --git a/docker/supervisord.conf b/docker/supervisord.conf new file mode 100644 index 00000000..3dd2ac76 --- /dev/null +++ b/docker/supervisord.conf @@ -0,0 +1,5 @@ +[supervisord] +nodaemon=true + +[include] +files = /app/conf.d/*.conf