+ php src container fully refactored and lightweight

* on host system container also refactored, some env options moved from .env to docker-compose example
* dnsmasq now is separate service file
+ php 8.3 support
* xdebug launch also refactored and lightweight
* tested and worked python environment with pyenv (on today without supervisor)
* database container and appropriate gui applications for management database systems moved into separate service files
+ build src php container helper
- remove unnecessary docker compose file version directive
- remove minio thing from the host php services
* use redis-local.conf from example and lightweight main redis conf file
This commit is contained in:
2025-01-13 18:16:42 +03:00
parent 57c56567cf
commit 49e44c9229
77 changed files with 2229 additions and 3192 deletions

View File

@ -0,0 +1,117 @@
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBCONF_NOWARNINGS=yes
# locales ~ 20 Mb
# libicu-dev ~ 50 Mb
# libpq-dev ~ 14 Mb
# libzip-dev ~ 2 Mb
# libbz2-dev ~ 1 Mb
# libfreetype6-dev ~ 6 Mb
# libpng-dev ~ 3 Mb
# libwebp-dev ~ 2 Mb
# libjpeg62-turbo-dev ~ 2 Mb
# apt install does not support -qq options and not to be quited long starter message with accumulative info about installed packages
# also apt upgrade and apt install with -qq option non propose automatic -y option, instead of apt-get install or apt-get upgrade
# But apt update is supporting -qq options for quiting output
RUN apt -qq update && \
apt-get install locales libicu-dev libpq-dev libzip-dev libbz2-dev \
libfreetype6-dev libpng-dev libwebp-dev libjpeg62-turbo-dev -qq
# For php7.4-fpm image - need to be upgraded apt packages
RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \
apt-get -qq upgrade \
;fi
###########################################################################
# Locale:
###########################################################################
RUN locale-gen en_US.UTF-8
###########################################################################
# Install PHP-extensions:
###########################################################################
RUN docker-php-ext-install -j$(nproc) iconv
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \
docker-php-ext-install -j$(nproc) gd
# opcache already installed and only need enable to
RUN docker-php-ext-enable opcache
# some extension already loaded by default (of course if or after is installed)
ARG EXTENSIONS='pdo intl mysqli pgsql zip bcmath bz2 pdo_mysql pdo_pgsql'
# Extension automatic enable in helper install script
# See: https://github.com/devilbox/docker-php-fpm-7.4/blob/master/data/docker-php-ext-install#L111
RUN docker-php-ext-install ${EXTENSIONS}
###########################################################################
# xDebug:
###########################################################################
# For PHP 7.4 xdebug 3.1 also is supported, but staty xdebug 2 version for compatibility experiences
# See https://xdebug.org/docs/compat
# And see exactly xdebug minor versions: https://pecl.php.net/package/xdebug
RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \
PHP_MINOR_VERSION=$(php -r 'echo PHP_MINOR_VERSION;') && \
if [ $PHP_MAJOR_VERSION = '8' ]; then \
pecl install xdebug-3.4.1; \
elif [ $PHP_MAJOR_VERSION = '7' ]; then \
pecl install xdebug-2.9.8; \
else \
echo "Not support that major PHP version: $PHP_MAJOR_VERSION"; \
exit 1; \
fi && \
docker-php-ext-enable xdebug && \
sed -i 's/^zend_extension=/;zend_extension=/g' "$PHP_INI_DIR/conf.d/docker-php-ext-xdebug.ini"
###########################################################################
# Redis:
###########################################################################
RUN pecl install -a redis && \
docker-php-ext-enable redis
###########################################################################
# Prepend nginx 502 on showing errors:
# @see https://stackoverflow.com/questions/55260221/laravel-php-7-3-nginx-502-upstream-prematurely-closed-fastcgi-stdout
###########################################################################
RUN sed -i 's/^log_limit = .*/log_limit = 1024/g' "$PHP_INI_DIR/../php-fpm.d/docker.conf"
###########################################################################
# php.ini opts:
###########################################################################
# https://github.com/php/php-src/blob/master/php.ini-development
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
###########################################################################
# Tune opts:
###########################################################################
ARG PHP_OPT_MEMORY_LIMIT=256M
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_POST_MAX_SIZE=300M
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=100M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_MAX_EXECUTION_TIME=600
RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTION_TIME/g" "$PHP_INI_DIR/php.ini"
#
#--------------------------------------------------------------------------
# Final Touch
#--------------------------------------------------------------------------
#
# Clean up
RUN apt clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
rm /var/log/lastlog /var/log/faillog

View File

@ -0,0 +1,19 @@
# syntax = edrevo/dockerfile-plus
FROM php:7.4-fpm
INCLUDE+ ./fpm/php.base.Dockerfile
ARG XDEBUG_INI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
COPY ./xdebug2.ini ${XDEBUG_INI_PATH}
###########################################################################
# Remove DST_Root_CA3
###########################################################################
# mozilla\/DST_Root_CA_X3.crt still exists in php-fpm container up to 7.4. On ~8.1 it was removed
RUN sed -i 's/^mozilla\/DST_Root_CA_X3\.crt/!mozilla\/DST_Root_CA_X3.crt/g' /etc/ca-certificates.conf && \
update-ca-certificates

View File

@ -0,0 +1,9 @@
# syntax = edrevo/dockerfile-plus
# Original image: https://github.com/docker-library/php/blob/52062af5056d0cd91fa5ded64fad8f9c82847b49/8.1/bookworm/fpm/Dockerfile
FROM php:8.1-fpm
INCLUDE+ ./fpm/php.base.Dockerfile
ARG XDEBUG_INI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
COPY ./xdebug3.ini ${XDEBUG_INI_PATH}

View File

@ -0,0 +1,8 @@
# syntax = edrevo/dockerfile-plus
FROM php:8.2-fpm
INCLUDE+ ./fpm/php.base.Dockerfile
ARG XDEBUG_INI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
COPY ./xdebug3.ini ${XDEBUG_INI_PATH}

View File

@ -0,0 +1,8 @@
# syntax = edrevo/dockerfile-plus
FROM php:8.3-fpm
INCLUDE+ ./fpm/php.base.Dockerfile
ARG XDEBUG_INI_PATH=/usr/local/etc/php/conf.d/xdebug.ini
COPY ./xdebug3.ini ${XDEBUG_INI_PATH}