Skip to content

Commit e89cb01

Browse files
authored
Merge pull request dunglas#40 from maxhelias/php-init
Use php.ini depending on env
2 parents 8172034 + bd3d8c6 commit e89cb01

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ RUN set -eux \
5252
&& docker-php-ext-enable --ini-name 05-opcache.ini opcache \
5353
&& apk del .build-deps
5454

55-
COPY docker/app/php.ini /usr/local/etc/php/php.ini
55+
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
56+
COPY docker/app/conf.d/symfony.ini $PHP_INI_DIR/conf.d/symfony.ini
5657
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
5758
COPY docker/app/docker-entrypoint.sh /usr/local/bin/docker-app-entrypoint
5859
RUN chmod +x /usr/local/bin/docker-app-entrypoint
File renamed without changes.

docker/app/docker-entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ if [ "${1#-}" != "$1" ]; then
77
fi
88

99
if [ "$1" = 'php-fpm' ] || [ "$1" = 'bin/console' ]; then
10+
PHP_INI_RECOMMENDED="$PHP_INI_DIR/php.ini-production"
11+
if [ "$APP_ENV" != 'prod' ]; then
12+
PHP_INI_RECOMMENDED="$PHP_INI_DIR/php.ini-development"
13+
fi
14+
ln -sf "$PHP_INI_RECOMMENDED" "$PHP_INI_DIR/php.ini"
15+
1016
# The first time volumes are mounted, the project needs to be recreated
1117
if [ ! -f composer.json ]; then
1218
composer create-project "symfony/skeleton $SYMFONY_VERSION" tmp --stability=$STABILITY --prefer-dist --no-progress --no-interaction

0 commit comments

Comments
 (0)