Add to your Dockerfile:
RUN docker-php-ext-configure opcache --enable-opcache \
&& docker-php-ext-install opcache
ADD php-config/opcache.ini /usr/local/etc/php/conf.d/opcache.ini
ADD php-config/opcache-blacklist.txt /usr/local/etc/opcache-blacklist.txt
Create php-config/opcache.ini
with this content:
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=11000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
opcache.enable=1
opcache.blacklist_filename=/usr/local/etc/opcache-blacklist.txt
Create php-config/opcache-blacklist.txt
with this content:
/var/www/app/*
/var/www/public/*
/var/www/storage/*
/var/www/routes/*
/var/www/config/*
/var/www/resources/*