bsky-dj/docker/entrypoint.sh
Óscar M. Lage 6fc6a49a26 Initial commit
Docker + Django fresh
2024-11-14 12:12:53 +01:00

33 lines
698 B
Bash
Executable File

#!/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