docker_entrypoint 484 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # This script is the entrypoint for our Docker image.
  3. set -ex
  4. # Set up display; otherwise rendering will fail
  5. Xvfb -screen 0 1024x768x24 &
  6. export DISPLAY=:0
  7. # Wait for the file to come up
  8. display=0
  9. file="/tmp/.X11-unix/X$display"
  10. for i in $(seq 1 10); do
  11. if [ -e "$file" ]; then
  12. break
  13. fi
  14. echo "Waiting for $file to be created (try $i/10)"
  15. sleep "$i"
  16. done
  17. if ! [ -e "$file" ]; then
  18. echo "Timing out: $file was not created"
  19. exit 1
  20. fi
  21. exec "$@"