+ 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:
117
src/dockerfiles/php/fpm/php.base.Dockerfile
Normal file
117
src/dockerfiles/php/fpm/php.base.Dockerfile
Normal 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
|
19
src/dockerfiles/php/fpm/php74.Dockerfile
Normal file
19
src/dockerfiles/php/fpm/php74.Dockerfile
Normal 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
|
||||
|
||||
|
||||
|
9
src/dockerfiles/php/fpm/php81.Dockerfile
Normal file
9
src/dockerfiles/php/fpm/php81.Dockerfile
Normal 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}
|
8
src/dockerfiles/php/fpm/php82.Dockerfile
Normal file
8
src/dockerfiles/php/fpm/php82.Dockerfile
Normal 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}
|
8
src/dockerfiles/php/fpm/php83.Dockerfile
Normal file
8
src/dockerfiles/php/fpm/php83.Dockerfile
Normal 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}
|
84
src/dockerfiles/php/workspace/artisan_bash_completion.sh
Normal file
84
src/dockerfiles/php/workspace/artisan_bash_completion.sh
Normal file
@ -0,0 +1,84 @@
|
||||
# This file is part of the Symfony package.
|
||||
#
|
||||
# (c) Fabien Potencier <fabien@symfony.com>
|
||||
#
|
||||
# For the full copyright and license information, please view
|
||||
# https://symfony.com/doc/current/contributing/code/license.html
|
||||
|
||||
_sf_artisan() {
|
||||
# Use newline as only separator to allow space in completion values
|
||||
IFS=$'\n'
|
||||
local sf_cmd="${COMP_WORDS[0]}"
|
||||
|
||||
# for an alias, get the real script behind it
|
||||
sf_cmd_type=$(type -t $sf_cmd)
|
||||
if [[ $sf_cmd_type == "alias" ]]; then
|
||||
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
|
||||
elif [[ $sf_cmd_type == "file" ]]; then
|
||||
sf_cmd=$(type -p $sf_cmd)
|
||||
fi
|
||||
|
||||
if [[ $sf_cmd_type != "function" && ! -x $sf_cmd ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cur prev words cword
|
||||
_get_comp_words_by_ref -n := cur prev words cword
|
||||
|
||||
local completecmd=("$sf_cmd" "_complete" "--no-interaction" "-sbash" "-c$cword" "-a1")
|
||||
for w in ${words[@]}; do
|
||||
w=$(printf -- '%b' "$w")
|
||||
# remove quotes from typed values
|
||||
quote="${w:0:1}"
|
||||
if [ "$quote" == \' ]; then
|
||||
w="${w%\'}"
|
||||
w="${w#\'}"
|
||||
elif [ "$quote" == \" ]; then
|
||||
w="${w%\"}"
|
||||
w="${w#\"}"
|
||||
fi
|
||||
# empty values are ignored
|
||||
if [ ! -z "$w" ]; then
|
||||
completecmd+=("-i$w")
|
||||
fi
|
||||
done
|
||||
|
||||
local sfcomplete
|
||||
if sfcomplete=$(${completecmd[@]} 2>&1); then
|
||||
local quote suggestions
|
||||
quote=${cur:0:1}
|
||||
|
||||
# Use single quotes by default if suggestions contains backslash (FQCN)
|
||||
if [ "$quote" == '' ] && [[ "$sfcomplete" =~ \\ ]]; then
|
||||
quote=\'
|
||||
fi
|
||||
|
||||
if [ "$quote" == \' ]; then
|
||||
# single quotes: no additional escaping (does not accept ' in values)
|
||||
suggestions=$(for s in $sfcomplete; do printf $'%q%q%q\n' "$quote" "$s" "$quote"; done)
|
||||
elif [ "$quote" == \" ]; then
|
||||
# double quotes: double escaping for \ $ ` "
|
||||
suggestions=$(for s in $sfcomplete; do
|
||||
s=${s//\\/\\\\}
|
||||
s=${s//\$/\\\$}
|
||||
s=${s//\`/\\\`}
|
||||
s=${s//\"/\\\"}
|
||||
printf $'%q%q%q\n' "$quote" "$s" "$quote";
|
||||
done)
|
||||
else
|
||||
# no quotes: double escaping
|
||||
suggestions=$(for s in $sfcomplete; do printf $'%q\n' $(printf '%q' "$s"); done)
|
||||
fi
|
||||
COMPREPLY=($(IFS=$'\n' compgen -W "$suggestions" -- $(printf -- "%q" "$cur")))
|
||||
__ltrim_colon_completions "$cur"
|
||||
else
|
||||
if [[ "$sfcomplete" != *"Command \"_complete\" is not defined."* ]]; then
|
||||
>&2 echo
|
||||
>&2 echo $sfcomplete
|
||||
fi
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _sf_artisan artisan
|
80
src/dockerfiles/php/workspace/workspace.base.Dockerfile
Normal file
80
src/dockerfiles/php/workspace/workspace.base.Dockerfile
Normal file
@ -0,0 +1,80 @@
|
||||
###########################################################################
|
||||
# Laradock non-root user:
|
||||
###########################################################################
|
||||
|
||||
# Thath might be changed in structure/dockerfiles and structure/.env
|
||||
ARG PUID=1000
|
||||
ARG PGID=1000
|
||||
|
||||
# For more infromation about set command: See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
|
||||
# RUN set -xe
|
||||
|
||||
RUN groupadd -g ${PGID} laradock && \
|
||||
useradd -u ${PUID} -g laradock -m laradock -G docker_env && \
|
||||
usermod -p "*" laradock -s /bin/bash
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ARG DEBCONF_NOWARNINGS=yes
|
||||
|
||||
RUN apt -qq update && \
|
||||
apt-get install tmux bash-completion inetutils-ping -qq
|
||||
|
||||
###########################################################################
|
||||
# Install PHP-extensions:
|
||||
###########################################################################
|
||||
|
||||
ARG EXTS=(bz2)
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
RUN for EXT in ${EXTS[@]}; do apt-get install -qq php${PHP_VERSION}-${EXT}; done
|
||||
SHELL ["/bin/sh", "-c"]
|
||||
|
||||
###########################################################################
|
||||
# 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 && \
|
||||
echo ';zend_extension=xdebug.so' > /etc/php/${PHP_VERSION}/cli/conf.d/20-xdebug.ini
|
||||
|
||||
###########################################################################
|
||||
# Redis:
|
||||
###########################################################################
|
||||
|
||||
RUN pecl install -a redis && \
|
||||
echo "extension=redis.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-redis.ini
|
||||
|
||||
###########################################################################
|
||||
# Check PHP version:
|
||||
###########################################################################
|
||||
|
||||
RUN php -v | head -n 1 | grep -q "PHP ${PHP_VERSION}."
|
||||
|
||||
###########################################################################
|
||||
# Tune opts:
|
||||
###########################################################################
|
||||
|
||||
ARG PHP_OPT_MEMORY_LIMIT=256M
|
||||
RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" /etc/php/${PHP_VERSION}/cli/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
|
||||
|
||||
# Set default work directory
|
||||
WORKDIR /var/www
|
9
src/dockerfiles/php/workspace/workspace74.Dockerfile
Normal file
9
src/dockerfiles/php/workspace/workspace74.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM laradock/workspace:latest-7.4
|
||||
|
||||
ARG PHP_VERSION=7.4
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
INCLUDE+ ./workspace/workspace.base.Dockerfile
|
||||
|
||||
INCLUDE+ ./workspace/xdebug2.Dockerfile
|
9
src/dockerfiles/php/workspace/workspace81.Dockerfile
Normal file
9
src/dockerfiles/php/workspace/workspace81.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM laradock/workspace:latest-8.1
|
||||
|
||||
ARG PHP_VERSION=8.1
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
INCLUDE+ ./workspace/workspace.base.Dockerfile
|
||||
|
||||
INCLUDE+ ./workspace/xdebug3.Dockerfile
|
9
src/dockerfiles/php/workspace/workspace82.Dockerfile
Normal file
9
src/dockerfiles/php/workspace/workspace82.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM laradock/workspace:latest-8.2
|
||||
|
||||
ARG PHP_VERSION=8.2
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
INCLUDE+ ./workspace/workspace.base.Dockerfile
|
||||
|
||||
INCLUDE+ ./workspace/xdebug3.Dockerfile
|
9
src/dockerfiles/php/workspace/workspace83.Dockerfile
Normal file
9
src/dockerfiles/php/workspace/workspace83.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
# syntax = edrevo/dockerfile-plus
|
||||
FROM laradock/workspace:latest-8.3
|
||||
|
||||
ARG PHP_VERSION=8.3
|
||||
ENV PHP_VERSION ${PHP_VERSION}
|
||||
|
||||
INCLUDE+ ./workspace/workspace.base.Dockerfile
|
||||
|
||||
INCLUDE+ ./workspace/xdebug3.Dockerfile
|
6
src/dockerfiles/php/workspace/xdebug2.Dockerfile
Normal file
6
src/dockerfiles/php/workspace/xdebug2.Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
ARG XDEBUG_INI_PATH=/etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini
|
||||
|
||||
COPY ./xdebug2.ini ${XDEBUG_INI_PATH}
|
||||
|
||||
RUN sed -i "s/^;xdebug.remote_host/xdebug.remote_host/g" ${XDEBUG_INI_PATH} && \
|
||||
sed -i "s/^xdebug.remote_connect_back/;xdebug.remote_connect_back/g" ${XDEBUG_INI_PATH}
|
6
src/dockerfiles/php/workspace/xdebug3.Dockerfile
Normal file
6
src/dockerfiles/php/workspace/xdebug3.Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
ARG XDEBUG_INI_PATH=/etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini
|
||||
|
||||
COPY ./xdebug3.ini ${XDEBUG_INI_PATH}
|
||||
|
||||
RUN sed -i "s/^;xdebug.client_host=dockerhost/xdebug.client_host=dockerhost/g" ${XDEBUG_INI_PATH} && \
|
||||
sed -i "s/^xdebug.discover_client_host/;xdebug.discover_client_host/g" ${XDEBUG_INI_PATH}
|
24
src/dockerfiles/php/xdebug2.ini
Normal file
24
src/dockerfiles/php/xdebug2.ini
Normal file
@ -0,0 +1,24 @@
|
||||
;xdebug.remote_host=dockerhost
|
||||
xdebug.remote_connect_back=1
|
||||
xdebug.remote_port=9000
|
||||
xdebug.idekey=PHPSTORM
|
||||
|
||||
xdebug.remote_autostart=1
|
||||
xdebug.remote_enable=1
|
||||
xdebug.cli_color=0
|
||||
xdebug.profiler_enable=1
|
||||
xdebug.profiler_enable_trigger=1
|
||||
xdebug.profiler_output_dir=/tmp/profiler
|
||||
|
||||
xdebug.remote_handler=dbgp
|
||||
xdebug.remote_mode=req
|
||||
|
||||
xdebug.var_display_max_children=-1
|
||||
xdebug.var_display_max_data=-1
|
||||
xdebug.var_display_max_depth=-1
|
||||
|
||||
xdebug.trace_enable_trigger=1
|
||||
xdebug.trace_output_dir=/tmp/trace
|
||||
xdebug.trace_output_name="trace.%t"
|
||||
|
||||
xdebug.show_exception_trace=1
|
5
src/dockerfiles/php/xdebug3.ini
Normal file
5
src/dockerfiles/php/xdebug3.ini
Normal file
@ -0,0 +1,5 @@
|
||||
xdebug.mode=off
|
||||
;xdebug.client_host=dockerhost
|
||||
xdebug.discover_client_host=1
|
||||
xdebug.start_with_request=yes
|
||||
xdebug.output_dir=/tmp/profiler
|
Reference in New Issue
Block a user