Add opcache to PHP container
This commit is contained in:
parent
42d96d6a2e
commit
df4fdbde3c
7 changed files with 23 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
|||
FROM nginx:1.23-alpine
|
||||
FROM nginx:1.23-alpine AS nginx-build
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM php:${PHP_VERSION}-fpm
|
||||
FROM php:${PHP_VERSION}-fpm AS php-build
|
||||
|
||||
RUN mkdir -p /var/www/html
|
||||
|
||||
|
@ -11,10 +11,13 @@ RUN apt-get -qq update && apt-get -qq install -y \
|
|||
libicu-dev \
|
||||
nano \
|
||||
bash \
|
||||
dnsutils
|
||||
dnsutils \
|
||||
> /dev/null 2>&1
|
||||
|
||||
RUN docker-php-ext-configure intl > /dev/null
|
||||
RUN docker-php-ext-configure intl > /dev/null 2>&1
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql sockets intl exif bcmath > /dev/null
|
||||
RUN docker-php-ext-install opcache > /dev/null 2>&1
|
||||
COPY ./opcache.ini "${PHP_INI_DIR}/conf.d"
|
||||
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
|
||||
|
||||
|
|
|
@ -1,10 +1,3 @@
|
|||
#RUN pecl install xdebug redis \
|
||||
# && docker-php-ext-enable redis
|
||||
#
|
||||
#COPY ./xdebug.ini.tmp "${PHP_INI_DIR}/conf.d/xdebug.ini"
|
||||
#RUN docker-php-ext-install opcache > /dev/null
|
||||
#COPY ./opcache.ini "${PHP_INI_DIR}/conf.d"
|
||||
|
||||
RUN pecl install xdebug
|
||||
RUN pecl install xdebug > /dev/null 2&>1
|
||||
|
||||
COPY ./xdebug.ini "${PHP_INI_DIR}/conf.d/xdebug.ini"
|
8
config/php-fpm/opcache.ini
Normal file
8
config/php-fpm/opcache.ini
Normal file
|
@ -0,0 +1,8 @@
|
|||
opcache.enabled=1
|
||||
opcache.revalidate_freq=0
|
||||
opcache.validate_timestamps=1
|
||||
opcache.max_accelerated_files=10000
|
||||
opcache.memory_consumption=192
|
||||
opcache.max_wasted_percentage=10
|
||||
opcache.interned_strings_buffer=16
|
||||
opcache.fast_shutdown=1
|
|
@ -139,6 +139,7 @@ class Config
|
|||
DataPathInterface::CONFIG_NGINX_DOCKERFILE => new SpinnerFilePath(DataPathInterface::CONFIG_NGINX_DOCKERFILE),
|
||||
'nodeDockerfileTemplate' => new SpinnerFilePath('config/php-fpm/Node.Dockerfile'),
|
||||
'xdebugIniTemplate' => new SpinnerFilePath('config/php-fpm/xdebug.ini'),
|
||||
'opcacheIniTemplate' => new SpinnerFilePath('config/php-fpm/opcache.ini'),
|
||||
'xdebugDockerfileTemplate' => new SpinnerFilePath('config/php-fpm/XDebug.Dockerfile'),
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,11 @@ class PHPDockerFileBuilder extends AbstractFileBuilder
|
|||
|
||||
$this->content = str_replace('${PHP_VERSION}', (string) $this->config->getPhpVersion($input), $this->content);
|
||||
|
||||
file_put_contents(
|
||||
(new SpinnerFilePath(sprintf('data/environments/%s/php-fpm/opcache.ini', $input->getArgument('name'))))->getProvidedPath(),
|
||||
file_get_contents($this->config->getFilePaths()->get('opcacheIniTemplate')->getAbsolutePath())
|
||||
);
|
||||
|
||||
if ($this->config->isNodeEnabled($input)) {
|
||||
$this->addNewLine();
|
||||
$this->content .= file_get_contents($this->config->getFilePaths()->get('nodeDockerfileTemplate')->getAbsolutePath());
|
||||
|
|
|
@ -92,15 +92,13 @@ class SpinCommand extends AbstractSpinnerCommand
|
|||
|
||||
passthru($command);
|
||||
|
||||
$this->style->success('Docker images built.');
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
protected function projectDataExists(): bool
|
||||
{
|
||||
if ($this->config->getFilePaths()->get('projectData')->exists()) {
|
||||
$this->style->warning('Project data already exists. Skipping new build.');
|
||||
$this->style->warning('Project already exists. Skipping new build.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue