Use php.ini depending on env

This commit is contained in:
Maxime Helias 2019-01-06 13:48:24 +01:00
parent 5f2d1f3a2d
commit bd3d8c6542
3 changed files with 8 additions and 1 deletions

View File

@ -52,7 +52,8 @@ RUN set -eux \
&& docker-php-ext-enable --ini-name 05-opcache.ini opcache \
&& apk del .build-deps
COPY docker/app/php.ini /usr/local/etc/php/php.ini
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY docker/app/conf.d/symfony.ini $PHP_INI_DIR/conf.d/symfony.ini
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
RUN chmod +x /usr/local/bin/docker-app-entrypoint

View File

@ -7,6 +7,12 @@ if [ "${1#-}" != "$1" ]; then
fi
if [ "$1" = 'php-fpm' ] || [ "$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"
# 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