2016-04-27 08:00:58 -07:00
|
|
|
#!/bin/sh
|
|
|
|
# This script is the entrypoint for our Docker image.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2018-05-14 17:39:56 -07:00
|
|
|
# Inject the mujoco license key (if planning to publish image, this step has to be runtime)
|
|
|
|
echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt
|
2016-08-10 16:12:51 -07:00
|
|
|
|
|
|
|
# Set up display; otherwise rendering will fail
|
2018-05-14 17:39:56 -07:00
|
|
|
Xvfb -screen 0 1024x768x24 &
|
|
|
|
export DISPLAY=:0
|
2016-04-27 08:00:58 -07:00
|
|
|
|
2016-08-10 16:12:51 -07:00
|
|
|
# Wait for the file to come up
|
2018-05-14 17:39:56 -07:00
|
|
|
display=0
|
2016-08-10 16:12:51 -07:00
|
|
|
file="/tmp/.X11-unix/X$display"
|
|
|
|
for i in $(seq 1 10); do
|
|
|
|
if [ -e "$file" ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Waiting for $file to be created (try $i/10)"
|
|
|
|
sleep "$i"
|
|
|
|
done
|
|
|
|
if ! [ -e "$file" ]; then
|
|
|
|
echo "Timing out: $file was not created"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-04-27 08:00:58 -07:00
|
|
|
exec "$@"
|