bsky-dj/docker/entrypoint.sh

33 lines
698 B
Bash
Raw Permalink Normal View History

2024-11-14 12:12:53 +01:00
#!/bin/bash
set -e
function wait_service {
while ! nc -z $1 $2; do
sleep 1
done
}
case $1 in
run-migrations)
echo "--> Applying migrations"
wait_service $MYSQL_HOST $MYSQL_PORT
cd $DOCUMENTROOT
exec python manage.py migrate --noinput
;;
run-server)
echo "--> Starting Django's server"
wait_service $MYSQL_HOST $MYSQL_PORT
exec python manage.py runserver 0.0.0.0:$APP_PORT
;;
run-tests)
echo "--> Starting Django's test framework"
wait_service $MYSQL_HOST $MYSQL_PORT
cd $DOCUMENTROOT
exec python manage.py test
;;
*)
exec "$@"
;;
esac