init
This commit is contained in:
34
api/docker/php/docker-entrypoint.sh
Executable file
34
api/docker/php/docker-entrypoint.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# first arg is `-f` or `--some-option`
|
||||
if [ "${1#-}" != "$1" ]; then
|
||||
set -- php-fpm "$@"
|
||||
fi
|
||||
|
||||
if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
|
||||
PHP_INI_RECOMMENDED="$PHP_INI_DIR/php.ini-production"
|
||||
if [ "$APP_ENV" != 'prod' ]; then
|
||||
PHP_INI_RECOMMENDED="$PHP_INI_DIR/php.ini-development"
|
||||
fi
|
||||
ln -sf "$PHP_INI_RECOMMENDED" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
mkdir -p var/cache var/log
|
||||
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
|
||||
setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var
|
||||
|
||||
if [ "$APP_ENV" != 'prod' ]; then
|
||||
composer install --prefer-dist --no-progress --no-suggest --no-interaction
|
||||
fi
|
||||
|
||||
echo "Waiting for db to be ready..."
|
||||
until bin/console doctrine:query:sql "SELECT 1" > /dev/null 2>&1; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [ "$APP_ENV" != 'prod' ]; then
|
||||
bin/console doctrine:schema:update --force --no-interaction
|
||||
fi
|
||||
fi
|
||||
|
||||
exec docker-php-entrypoint "$@"
|
||||
Reference in New Issue
Block a user