Skip to content
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ coverage.xml
# Sphinx documentation
docs/_build/

# symoro-robot
symoro-robots
57 changes: 57 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
FROM ubuntu:18.04

# essential packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
xauth \
git \
wget \
nano \
sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# user
ARG USER_UID=1001
ARG GROUP_UID=1001
ARG USERNAME=user

RUN groupadd --gid $GROUP_UID $USERNAME \
&& useradd --uid $USER_UID --gid $GROUP_UID -m $USERNAME \
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

WORKDIR /home/$USERNAME

# symoro
RUN git -c http.sslVerify=false clone https://github.com/fleborne/symoro.git /home/$USERNAME/symoro

RUN apt-get update && apt-get install -q -y --no-install-recommends \
python2.7 \
virtualenv \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -q -y --no-install-recommends \
libgtk-3-dev \
freeglut3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /home/$USERNAME

RUN /usr/bin/virtualenv --python=python2.7 symoro-env && \
. /home/$USERNAME/symoro-env/bin/activate && \
pip install -r /home/$USERNAME/requirements.txt && \
wget https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.7-cp27-cp27mu-linux_x86_64.whl && \
pip install wxPython-4.0.7-cp27-cp27mu-linux_x86_64.whl && \
cd /home/$USERNAME/symoro && \
python setup.py install

RUN chown -R $USERNAME:$USERNAME /home/$USERNAME

# entrypoint
COPY ./entrypoint.sh /entrypoint.sh
RUN sudo chmod +x /entrypoint.sh

SHELL [ "/bin/bash", "-c" ]
ENTRYPOINT ["/entrypoint.sh"]
CMD [ "/bin/bash" ]
34 changes: 34 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Docker environment for symoro

## Pre-requisites

### For Linux
- Install [Docker Engine](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository);
- Do the [post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/);

### For WSL2
- Install [WSL2](https://learn.microsoft.com/fr-fr/windows/wsl/install);
- Install [Docker Desktop](https://docs.docker.com/desktop/install/windows-install/);
- Install [Terminal](https://learn.microsoft.com/fr-fr/windows/terminal/install).

Then, install the Docker image and create a container.

## Docker Hub

The image is available on the Docker Hub : see [baaluidnrey/symoro](https://hub.docker.com/repository/docker/baaluidnrey/symoro/general).

## Build from sources

```bash
# 1. clone symoro
git clone -b docker https://github.com/baaluidnrey/symoro

# 2. install the image
cd symoro/docker
./install_docker.sh

# 3. launch symoro
./start_symoro.sh
```

The volume `symoro-robots` is mounted in the docker container to the location of the saved files.
12 changes: 12 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

# xauth ---
if [[ -f /dot.Xauthority ]]; then
xauth merge /dot.Xauthority
fi
# ----------

# symoro ---
source /home/user/symoro-env/bin/activate
symoro-bin
# ----------
2 changes: 2 additions & 0 deletions docker/install_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker build --tag symoro .
docker image prune
4 changes: 4 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sympy==0.7.3
numpy==1.6.1
# wxPython >= 2.8.12
PyOpenGL==3.0.1b2
24 changes: 24 additions & 0 deletions docker/start_symoro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
if [ ! -d $PWD/../symoro-robots ]; then
mkdir $PWD/../symoro-robots
chgrp docker $PWD/../symoro-robots
chmod g+rw $PWD/../symoro-robots
fi

# Settings to use graphical applications : linux or wsl ?
if [ -f /tmp/.X11-unix ]; then
DOCKER_GUI="--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="$XAUTHORITY:/dot.Xauthority""
elif [ -d /mnt/wslg ]; then
DOCKER_GUI="--volume="/mnt/wslg:/mnt/wslg" --volume="/mnt/wslg/.X11-unix:/tmp/.X11-unix""
else
DOCKER_GUI=""
fi

docker run -it --rm \
--env DISPLAY \
--env QT_X11_NO_MITSHM=1 \
--net="host" \
$DOCKER_GUI \
--user user \
--name="symoro" \
--volume="$PWD/../symoro-robots:/home/user/symoro-robots" \
symoro