RoboCup-SSL / grSim

RoboCup Small Size Robot Soccer Simulator
https://ssl.robocup.org/league-software/
Other
128 stars 130 forks source link

Add dockerfile and make grSim run without a display #146

Closed g3force closed 3 years ago

g3force commented 3 years ago

This PR adds a Dockerfile that builds and bundles grSim.

It also contains some necessary tweak to make the container run without requiring a display. The available headless mode was not sufficient, as QT still tried to create a window.

I have not yet tested running it with the UI.

The image is already available on Docker Hub: https://hub.docker.com/r/robocupssl/grsim

mahi97 commented 3 years ago

That's great. There is also another dockerfile in this repo. To my best knowledge, it was working fine with UI.

I believe some changes should be applied for using vnc instead of Xserver to make it cross-platform.

# Install vnc, xvfb to create a 'fake' display and grsim
RUN     apt-get install -y x11vnc xvfb grsim
RUN     mkdir ~/.vnc
# Setup a password
RUN     x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart grsim (might not be the best way to do it, but it does the trick)
RUN     bash -c 'echo "grsim" >> /.bashrc'

and running

docker run -p 5900:5900 -e HOME=/ <your_docker_image> x11vnc -forever -usepw -create
g3force commented 3 years ago

Inspired by your suggestion, I've updated the image. It can now be run with or without a VNC server.

g3force commented 3 years ago

I would not build an image for every branch. It is indeed interesting that the docker build status is shown in the PR. In this case, this is only because I temporary configured this feature branch manually ;)

But we can take the code from the docker file and adapt it for the CI, if necessary.