Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile for M1 Mac #426

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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に追加してもよい
```

Expand Down
45 changes: 45 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
30 changes: 30 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +12 to +14

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should remove these lines before merging.

$ 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!

5 changes: 5 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

docker build --rm \
-t="jsk-enshu/ros-novnc-web:latest" \
.
3 changes: 3 additions & 0 deletions docker/conf.d/fluxbox.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:fluxbox]
command=fluxbox
autorestart=true
3 changes: 3 additions & 0 deletions docker/conf.d/websockify.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:websockify]
command=websockify --web /usr/share/novnc 8080 localhost:5900
autorestart=true
3 changes: 3 additions & 0 deletions docker/conf.d/x11vnc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:x11vnc]
command=x11vnc -forever -shared
autorestart=true
3 changes: 3 additions & 0 deletions docker/conf.d/xterm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[program:xterm]
command=xterm
autorestart=true
3 changes: 3 additions & 0 deletions docker/conf.d/xvfb.conf
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

docker run -it -p 8080:8080 \
--name ros-novnc-web \
jsk-enshu/ros-novnc-web:latest
5 changes: 5 additions & 0 deletions docker/supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[supervisord]
nodaemon=true

[include]
files = /app/conf.d/*.conf