Skip to content

Commit

Permalink
Introduce OPCache in the Docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
tchapi committed Apr 2, 2024
1 parent 37f003c commit 5b158af
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM php:8.2-fpm-alpine
ARG fpm_user=82:82
ENV FPM_USER=${fpm_user}

ENV PHP_OPCACHE_MEMORY_CONSUMPTION="256" \
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10"

LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.url="https://github.com/tchapi/davis/pkgs/container/davis"
LABEL org.opencontainers.image.description="A simple, fully translatable admin interface for sabre/dav based on Symfony 5 and Bootstrap 4"
Expand Down Expand Up @@ -63,6 +66,10 @@ RUN apk --update --virtual build-deps-imap add --no-cache imap-dev openssl-dev k
&& apk del build-deps-imap \
&& rm -rf /tmp/*

# OPCache
RUN docker-php-ext-install opcache
COPY ./docker/configurations/opcache.ini /usr/local/etc/php/conf.d/opcache.ini

# PHP-FPM healthcheck
RUN set -xe && echo "pm.status_path = /status" >> /usr/local/etc/php-fpm.d/zz-docker.conf
RUN curl https://raw.githubusercontent.com/renatomefi/php-fpm-healthcheck/v0.5.0/php-fpm-healthcheck \
Expand Down
10 changes: 10 additions & 0 deletions docker/configurations/opcache.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
opcache.enable=1
opcache.jit=1255
opcache.jit_buffer_size=128M
opcache.revalidate_freq=60
opcache.save_comments=1
opcache.validate_timestamps=1
opcache.max_accelerated_files=32531
opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}
opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}
opcache.interned_strings_buffer=64

0 comments on commit 5b158af

Please sign in to comment.