Skip to content

Instantly share code, notes, and snippets.

@acip
Created May 21, 2018 08:01
Show Gist options
  • Save acip/06b7b8ee26110e5e56519ce50f76c8b2 to your computer and use it in GitHub Desktop.
Save acip/06b7b8ee26110e5e56519ce50f76c8b2 to your computer and use it in GitHub Desktop.
Optimze Laravel speed in Docker for Windows/MacOS using opcache.

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/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment