feat: add support for PHP preloading

This commit is contained in:
Kévin Dunglas 2020-10-14 22:14:41 +02:00
parent 7ab611a755
commit 0167334910
No known key found for this signature in database
GPG Key ID: 9D0C5D6EEB42C445
4 changed files with 19 additions and 7 deletions

View File

@ -5,7 +5,7 @@
# https://docs.docker.com/engine/reference/builder/#understand-how-arg-and-from-interact
ARG PHP_VERSION=7.4
ARG NGINX_VERSION=1.17
ARG NGINX_VERSION=1.19
# "php" stage
FROM php:${PHP_VERSION}-fpm-alpine AS symfony_php
@ -20,7 +20,7 @@ RUN apk add --no-cache \
jq \
;
ARG APCU_VERSION=5.1.18
ARG APCU_VERSION=5.1.19
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
@ -56,7 +56,7 @@ RUN set -eux; \
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
RUN ln -s $PHP_INI_DIR/php.ini-production $PHP_INI_DIR/php.ini
COPY docker/php/conf.d/symfony.ini $PHP_INI_DIR/conf.d/symfony.ini
COPY docker/php/conf.d/symfony.prod.ini $PHP_INI_DIR/conf.d/symfony.ini
RUN set -eux; \
{ \

View File

@ -17,11 +17,9 @@ services:
volumes:
# Comment out the next line in production
- ./:/srv/app:rw,cached
- ./docker/php/conf.d/symfony.dev.ini:/usr/local/etc/php/conf.d/symfony.ini
# If you develop on Linux, comment out the following volumes to just use bind-mounted project directory from host
- /srv/app/var/
- /srv/app/var/cache/
- /srv/app/var/logs/
- /srv/app/var/sessions/
# - ./api/var:/srv/app/var:rw
environment:
- SYMFONY_VERSION

View File

@ -0,0 +1,14 @@
apc.enable_cli = 1
date.timezone = UTC
session.auto_start = Off
short_open_tag = Off
# https://symfony.com/doc/current/performance.html
opcache.interned_strings_buffer = 16
opcache.max_accelerated_files = 20000
opcache.memory_consumption = 256
opcache.validate_timestamps = 0
realpath_cache_size = 4096K
realpath_cache_ttl = 600
opcache.preload_user=www-data
opcache.preload=/srv/app/var/cache/prod/App_KernelProdContainer.preload.php