dtcooper / tuxracer-web

Tux Racer In Your Browser (In a Headless Docker Container) ¯\_(ツ)_/¯
https://dtcooper.github.io/tuxracer-web/
MIT License
28 stars 4 forks source link
docker tux-racer vnc

Wow! It's Tux Racer In Your Browser!

tl;dr

Run the following in your shell on Linux or macOS,

docker run -dp 80:80 dtcooper/tuxracer-web && sleep 2 && python -m webbrowser http://localhost/

ZOMG! Holy moly! It's Tux Racer! What great fun! This is dumb! Yes it is! I like exclamation marks? Probably! Okay?

More Info

Wow! Now you can run Extreme Tux Racer in a Docker container, playing it in your web browser using noVNC over a VNC-to-websocket bridge.

Why? Because you can. ¯\_(ツ)_/¯

Running - It's Easy Peasy Lemon Squeezy!

Make sure you have Docker installed, then run the container exposing port 80,

docker run -p 80:80 dtcooper/tuxracer-web

Finally, navigate to http://localhost/ in your web browser et voilà!

Screenshot

Screenshot

Configuration

You shouldn't need to configure this ridiculous piece of software, but if you want to it's as easy as setting one of the following environment variables,

For example, the following runs at 1024x768 resolution, sets the VNC password to shrimp, and prints verbose log information,

docker run -p 80:80 -e RESOLUTION=1024x768 -e PASSWORD=shrimp -e VERBOSE=1 dtcooper/tuxracer-web

Sound

Out Of The Box (Icecast)

If you want to give the experimental Icecast sound backend a try, just set the environment variable ICECAST=1. It should start playing in your browser. Note that this will be massively delayed due to encoding and buffering by the server, as well as buffering by your browser.

docker run -p 80:80 -e ICECAST=1 dtcooper/tuxracer-web

Linux

To make sound work on Linux, just expose your /dev/snd device while starting up the container.

docker run -p 80:80 --device /dev/snd dtcooper/tuxracer-web

macOS (Using PulseAudio)

On macOS, first install PulseAudio, for example here using Homebrew,

brew install pulseaudio

Next, start PulseAudio loading the native-protocol-tcp module and share its configuration directory. This way the Pulse daemon's auth cookie can be shared with the container and it can forward sound.

pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon
docker run -p 80:80 -v ~/.config/pulse:/root/.config/pulse dtcooper/tuxracer-web

Running a Program In The Container

If you for some odd reason want a shell or to run a program inside of the container, provide it as an argument. For example to shell into bash,

docker run -it -p 80:80 dtcooper/tuxracer-web bash

Building The Container Yourself

Clone this repo and build the container,

git clone https://github.com/dtcooper/tuxracer-web
docker build -t tuxracer-web tuxracer-web

Finally run it locally,

docker run -p 80:80 tuxracer-web

That's all folks!

Author and License

This project was created by David Cooper and is licensed under the MIT License. See the LICENSE file for details.