#!/bin/bash #immediatly exit if a command fails: set -e # waiting for the database to be ready if [ -z "${DATABASE_HOST}" ]; then while ! timeout 1 bash -c "cat < /dev/null > /dev/tcp/${DATABASE_HOST}/${DATABASE_PORT}" do echo "$(date) : waiting one second for database"; sleep 1; done echo "$(date) : the database is ready"; else echo "we assume the database is ready"; fi if [ "${APP_ENV}" = "prod" ]; then composer dump-env "${APP_ENV}" chmod +r /var/www/app/.env.local.php if [ "${PREVENT_MIGRATIONS}" != "true" ]; then php /var/www/app/bin/console doctrine:migrations:status php /var/www/app/bin/console doctrine:migrations:migrate -n php /var/www/app/bin/console messenger:setup-transports php /var/www/app/bin/console chill:db:sync-views fi fi if [ "${CLEAR_CACHE}" != "false" ]; then #prepare cache php /var/www/app/bin/console cache:clear --no-warmup fi exec "${@}"