/robocode

Containerized: Robocode

Primary LanguageShellMIT LicenseMIT

Prerequisites

MacOS

We will need to get xhost and socat to run GUI display from container

TL;DR

if ! command -v xquartz > /dev/null; then brew install xquartz;  else echo "Xquartz already installed"; fi

if ! command -v socat > /dev/null; then brew install socat; else echo "SOCAT already installed"; fi

osascript -e 'tell application "Terminal" to do script "socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\\\"$DISPLAY\\\""'

export ROBOCODE_LOCAL_IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')

docker-compose up --build

Install X11

brew install xquartz;

After installation, Open up xquartz using command xquartz or icon click, then:
XQUARTZ > Preferences > Security > Allow connections from network clients > ✅ (check)

Install SOCAT

brew install socat;

Run Socat

osascript -e 'tell application "Terminal" to do script "socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\""'

Configure variables for container

export ROBOCODE-LOCAL-IP=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')

Build Docker image

Make sure docker service is running

docker-compose build

Run docker image

docker-compose up

or docker-compose up --build