feat: allow to install the website skeleton (#152)

* feat: allow to install the website skeleton

* wip

* wip

* cleanup

* revert rename in docs

* cleanup
This commit is contained in:
Kévin Dunglas
2021-06-14 15:12:18 +02:00
committed by GitHub
parent a0192fdac4
commit c99c188211
6 changed files with 43 additions and 18 deletions

View File

@@ -17,19 +17,27 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
# The first time volumes are mounted, the project needs to be recreated
if [ ! -f composer.json ]; then
composer create-project "symfony/skeleton $SYMFONY_VERSION" tmp --stability=$STABILITY --prefer-dist --no-progress --no-interaction
jq '.extra.symfony.docker=true' tmp/composer.json >tmp/composer.tmp.json
rm tmp/composer.json
mv tmp/composer.tmp.json tmp/composer.json
CREATION=1
composer create-project "$SKELETON $SYMFONY_VERSION" tmp --stability="$STABILITY" --prefer-dist --no-progress --no-interaction --no-install
cd tmp
composer config --json extra.symfony.docker 'true'
cp -Rp . ..
cd -
cp -Rp tmp/. .
rm -Rf tmp/
elif [ "$APP_ENV" != 'prod' ]; then
rm -f .env.local.php
composer install --prefer-dist --no-progress --no-interaction
fi
composer install --prefer-dist --no-progress --no-interaction
if grep -q ^DATABASE_URL= .env; then
if [ "$CREATION" = "1" ]; then
echo "To finish the installation please press Ctrl+C to stop Docker Compose and run: docker-compose up --build"
sleep infinity
fi
echo "Waiting for db to be ready..."
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
until [ $ATTEMPTS_LEFT_TO_REACH_DATABASE -eq 0 ] || DATABASE_ERROR=$(bin/console dbal:run-sql "SELECT 1" 2>&1); do