-
-
Notifications
You must be signed in to change notification settings - Fork 733
/
docker-entrypoint.sh
executable file
·36 lines (29 loc) · 1.14 KB
/
docker-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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
# 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
cp -Rp tmp/. .
rm -Rf tmp/
elif [ "$APP_ENV" != 'prod' ]; then
rm -f .env.local.php
composer install --prefer-dist --no-progress --no-suggest --no-interaction
fi
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var
fi
exec docker-php-entrypoint "$@"