docker-entrypoint.sh 644 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. #
  3. # WyOJ web container entrypoint.
  4. #
  5. # First start (no /var/uoj_data/.UOJSetupDone) runs the installer, which writes
  6. # app/.config.php from the environment and waits for the database. Later
  7. # starts go straight to apache, so recreating the container is cheap.
  8. set -e
  9. if [ ! -f /var/uoj_data/.UOJSetupDone ]; then
  10. echo "==> first start: running install.sh -i"
  11. bash /opt/uoj/web/install.sh -i
  12. else
  13. echo "==> install already done, skipping"
  14. fi
  15. # ntp needs CAP_SYS_TIME, which containers normally do not have -- never fail.
  16. service ntp start >/dev/null 2>&1 || true
  17. echo "==> starting apache"
  18. exec apachectl -D FOREGROUND