Update Dockerfile for v2-fmp-alpine: enhance PHP configuration and opcache settings
This commit is contained in:
1 parent
9357f46272
commit
ac15216de3
2 files changed
+140
-27
No files matched your search
+18
-26
@@ -4,16 +4,12 @@ FROM php:8.4-fpm-alpine
|
||||
ENV APP_ROOT="/var/www/html"
|
||||
|
||||
ENV TZ="Europe/Prague" \
|
||||
PHP_INI_FILE="$PHP_INI_DIR/php.ini" \
|
||||
COMPOSER_ALLOW_SUPERUSER=1 \
|
||||
PHP_OPCACHE_ENABLE=1 \
|
||||
PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \
|
||||
PHP_OPCACHE_REVALIDATE_FREQ=0 \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION=192 \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES=20000 \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE=10 \
|
||||
PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16 \
|
||||
APP_ENV=production \
|
||||
APP_DEBUG=false
|
||||
PHP_OPCACHE_VALIDATE_TIMESTAMPS="1" \
|
||||
PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \
|
||||
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
|
||||
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
tzdata \
|
||||
@@ -81,29 +77,25 @@ RUN php -r 'if (!in_array("JPEG", Imagick::queryFormats())) { fwrite(STDERR, "ER
|
||||
# Composer
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
|
||||
&& echo "date.timezone=${TZ}" > "$PHP_INI_DIR/conf.d/99-timezone.ini"
|
||||
|
||||
RUN { \
|
||||
echo "memory_limit=256M"; \
|
||||
echo "upload_max_filesize=100M"; \
|
||||
echo "post_max_size=100M"; \
|
||||
echo "realpath_cache_size=4096K"; \
|
||||
echo "realpath_cache_ttl=600"; \
|
||||
} > "$PHP_INI_DIR/conf.d/99-laravel.ini"
|
||||
# PHP
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_FILE" && \
|
||||
sed -i "s|memory_limit = 128M|memory_limit = 256M |g" "$PHP_INI_FILE" && \
|
||||
sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 100M |g" "$PHP_INI_FILE" && \
|
||||
sed -i "s|post_max_size = 8M|post_max_size = 100M |g" "$PHP_INI_FILE" && \
|
||||
printf '[Date]\ndate.timezone="%s"\n' "$TZ" > "$PHP_INI_DIR/conf.d/tzone.ini"
|
||||
|
||||
#OPCACHE
|
||||
RUN { \
|
||||
echo "[opcache]"; \
|
||||
echo "opcache.enable=${PHP_OPCACHE_ENABLE}"; \
|
||||
echo "opcache.enable_cli=0"; \
|
||||
echo "opcache.enable=1"; \
|
||||
echo "opcache.revalidate_freq=0"; \
|
||||
echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \
|
||||
echo "opcache.revalidate_freq=${PHP_OPCACHE_REVALIDATE_FREQ}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.interned_strings_buffer=${PHP_OPCACHE_INTERNED_STRINGS_BUFFER}"; \
|
||||
echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \
|
||||
echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \
|
||||
echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \
|
||||
echo "opcache.save_comments=1"; \
|
||||
} > "$PHP_INI_DIR/conf.d/10-opcache.ini"
|
||||
echo "opcache.interned_strings_buffer=16"; \
|
||||
echo "opcache.fast_shutdown=1"; \
|
||||
} > "$PHP_INI_DIR/conf.d/opcache.ini"
|
||||
|
||||
# Supervisor (queue workers + scheduler, started from entrypoint.d/90-supervisord.sh)
|
||||
RUN mkdir -p /var/log/supervisor
|
||||
|
||||
Reference in new issue
Block a user