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

Add Dockerfile and introduction in readme #198

Merged
merged 6 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
90 changes: 90 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# base image
FROM ubuntu:focal
Copy link
Member

Choose a reason for hiding this comment

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

Hello @mikihiroikura @arrenglover ! Just a curiosity, there is any reason you need to use Ubuntu 20.04 instead of a more modern distribution? We are discussing about dropping Ubuntu 20.04 support for apt dependencies in robotology/robotology-superbuild#1439, and I am afraid that the next YARP release will not support Ubuntu 20.04 with apt dependencies.


ENV DEBIAN_FRONTEND=noninteractive

ARG CODE_DIR=/usr/local/src

#basic environment
RUN apt update && apt install -y \
ca-certificates \
build-essential \
git \
cmake \
cmake-curses-gui \
libace-dev \
libassimp-dev \
libglew-dev \
libglfw3-dev \
libglm-dev \
libeigen3-dev

# Suggested dependencies for YARP
RUN apt update && apt install -y \
qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev \
qml-module-qtquick2 qml-module-qtquick-window2 \
qml-module-qtmultimedia qml-module-qtquick-dialogs \
qml-module-qtquick-controls qml-module-qt-labs-folderlistmodel \
qml-module-qt-labs-settings \
libqcustomplot-dev \
libgraphviz-dev \
libjpeg-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-libav

# Add metavision-sdk in sources.list
RUN echo "deb [arch=amd64 trusted=yes] https://apt.prophesee.ai/dists/public/b4b3528d/ubuntu focal sdk" >> /etc/apt/sources.list &&\
apt update

RUN apt install -y \
libcanberra-gtk-module \
mesa-utils \
ffmpeg \
libboost-program-options-dev \
libopencv-dev \
metavision-sdk

# YCM
ARG YCM_VERSION=v0.15.2
RUN cd $CODE_DIR && \
git clone --depth 1 --branch $YCM_VERSION https://github.com/robotology/ycm.git && \
cd ycm && \
mkdir build && cd build && \
cmake .. && \
make -j `nproc` install

# YARP
ARG YARP_VERSION=v3.8.0
RUN cd $CODE_DIR && \
git clone --depth 1 --branch $YARP_VERSION https://github.com/robotology/yarp.git &&\
cd yarp &&\
mkdir build && cd build &&\
cmake .. &&\
make -j `nproc` install

EXPOSE 10000/tcp 10000/udp
RUN yarp check


# event-driven
ARG ED_VERSION=master
RUN cd $CODE_DIR &&\
git clone --depth 1 --branch $ED_VERSION https://github.com/robotology/event-driven.git &&\
cd event-driven &&\
mkdir build && cd build &&\
cmake .. &&\
make -j `nproc` install

# Add User ID and Group ID
ARG UNAME=testuser
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME

# Change user and working directory
USER $UNAME
WORKDIR /home/${UNAME}
31 changes: 31 additions & 0 deletions documentation/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Setup docker environment
### Check udev rules in your host environment
```
ls /etc/udev/rules.d -alh

# If you don't have `88-cyusb.rule` and `99-evkv2.rules` in this folder,
# Add them with following commands
# Otherwise, you can skip these commands
sudo wget -P /etc/udev/rules.d https://raw.githubusercontent.com/prophesee-ai/openeb/main/hal_psee_plugins/resources/rules/88-cyusb.rules
sudo wget -P /etc/udev/rules.d https://raw.githubusercontent.com/prophesee-ai/openeb/main/hal_psee_plugins/resources/rules/99-evkv2.rules

# Reload udev rules in your host environment
sudo udevadm control --reload-rules
sudo udevadm trigger
```

### Build docker image
```
docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t event-driven:latest .
```
- Input current User ID and Group ID into Docker environment

### Run and enter docker container
```
docker run -it --privileged --network host -v /tmp/.X11-unix/:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -e DISPLAY=unix$DISPLAY --name event-driven event-driven:latest
```

### Open X Server for docker environment
```
xhost local:docker
```