-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrobo
35 lines (29 loc) · 1.03 KB
/
robo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# Set robocode root folder, where the project has been cloned.
if [ -z "$ROBO_ROOT" ]; then
echo "ERROR: ROBO_ROOT is unset! Please set it to where robocode has been cloned. Aborting."
exit 1
fi
# Set config folder, where properties are stored. To override it set the $ROBO_CONF variable to your desired folder.
if [ -z "$ROBO_CONF" ]; then
export ROBO_CONF=$ROBO_ROOT/.config
fi
# Set robots .class files path, where robots are stored. To override it set the $ROBO_BOTS variable to your desired folder.
if [ -z "$ROBO_BOTS" ]; then
export ROBO_BOTS=$ROBO_ROOT/target/classes/robots
fi
# Initialize the directories
mkdir -p $ROBO_CONF $ROBO_BOTS
# Make sure user has r/w permissions to robocode data volumes
chmod -R 755 $ROBO_CONF $ROBO_BOTS
# Run robocode in a container, with user permissions
docker run -it \
-u $(id -u):$(id -g) \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $ROBO_CONF:/robocode/config \
-v $ROBO_BOTS:/robocode/robots/robots \
-e ROBO_ROOT \
-e ROBO_CONF \
-e ROBO_BOTS \
-e DISPLAY \
fbcbarbosa/robocode