Разделение конфигов php, мелочи по compose.yml

This commit is contained in:
2025-03-15 20:56:18 +08:00
parent 1b055797d6
commit 31fa1a0f5a
7 changed files with 47 additions and 29 deletions

View File

@@ -0,0 +1,21 @@
FROM php:8.3-fpm
RUN apt update && \
apt upgrade -y && \
apt install -y git
# https://pecl.php.net/package/redis
RUN pecl channel-update pecl.php.net && \
pecl install redis && \
docker-php-ext-enable redis && \
mkdir -p /var/log/php && \
chmod -R 777 /var/log/php && \
git config --global --add safe.directory /var/www
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
USER www-data
EXPOSE 9000
WORKDIR /var/www
CMD composer install --no-dev --optimize-autoloader
ENTRYPOINT php-fpm

16
docker/php/prod/php.ini Normal file
View File

@@ -0,0 +1,16 @@
[PHP]
error_reporting = E_ALL
expose_php = Off
file_uploads = Off
memory_limit = 512M
; upload_max_filesize=10M
; post_max_size=10M
[opcache]
opcache.enable = 1
opcache.enable_cli = 1
opcache.memory_consumption = 128
opcache.max_accelerated_files = 30000
opcache.revalidate_freq = 0
opcache.jit_buffer_size = 64M
opcache.jit = tracing

21
docker/php/prod/www.conf Normal file
View File

@@ -0,0 +1,21 @@
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 50
pm.status_path = /status
ping.path = /ping
ping.response = pong
access.log = /var/log/php/$pool.access.log
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%"
; chroot = /var/www
; chdir = /var/www
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/php/$pool.error.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 512M