+ 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

@ -1,9 +0,0 @@
; Load igbinary extension
;extension=igbinary.so
; Use igbinary as session serializer
session.serialize_handler=igbinary
; Enable or disable compacting of duplicate strings
; The default is On.
igbinary.compact_strings=On

View File

@ -0,0 +1,93 @@
USER root
###########################################################################
# Set custom timezone if needed
###########################################################################
ARG CUSTOM_TZ=Etc/UTC
RUN if [ ${CUSTOM_TZ} -ne $(cat /etc/timezone) ]; then \
ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && \
echo $CUSTOM_TZ > /etc/timezone \
;fi
###########################################################################
# Set additional locale if needed:
###########################################################################
ARG CUSTOM_LOCALE=en_US.UTF-8
RUN if [ ${CUSTOM_LOCALE} -ne 'en_US.UTF-8' ]; then \
locale-gen ${CUSTOM_LOCALE} \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
USER root
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# Libreoffice
###########################################################################
USER root
ARG INSTALL_LIBREOFFICE=false
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
apt update -qq && \
apt-get install libreoffice-nogui -qq --no-install-recommends \
;fi
###########################################################################
# НУЦ:
###########################################################################
USER root
ARG INSTALL_NUC_CERTS=false
RUN if [ ${INSTALL_NUC_CERTS} = true ]; then \
mkdir /usr/local/share/ca-certificates/extra && \
cd /usr/local/share/ca-certificates/extra && \
curl -O https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt && \
curl -O https://gu-st.ru/content/lending/russian_trusted_sub_ca_pem.crt && \
update-ca-certificates \
;fi
###########################################################################
# Tune opts:
###########################################################################
USER root
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_POST_MAX_SIZE/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"
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" "$PHP_INI_DIR/php.ini"
###########################################################################
# Cleanup
###########################################################################
USER root
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@ -1,43 +0,0 @@
FROM dimti/php:5.6
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# xDebug (termporary):
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
###########################################################################
# Permission denied on /tmp folder:
###########################################################################
RUN chmod 1777 /tmp
###########################################################################
# Tune opts:
###########################################################################
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/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"
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=48M
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"

View File

@ -1,62 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/php:7.4
###########################################################################
# Redis and igbinary:
###########################################################################
ARG PHP_VERSION=7.4
ENV PHP_VERSION ${PHP_VERSION}
ARG INSTALL_REDIS=false
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a igbinary \
&& docker-php-ext-enable igbinary \
&& printf "yes\n" | pecl install redis \
&& docker-php-ext-enable redis \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# xDebug (termporary):
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug2/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
###########################################################################
# НУЦ:
###########################################################################
RUN mkdir /usr/local/share/ca-certificates/extra && \
cd /usr/local/share/ca-certificates/extra && \
curl -O https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt && \
curl -O https://gu-st.ru/content/lending/russian_trusted_sub_ca_pem.crt && \
update-ca-certificates
###########################################################################
# Tune opts:
###########################################################################
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/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"
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=48M
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
INCLUDE+ ./php.base.Dockerfile

View File

@ -1,66 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/php:8.1
###########################################################################
# Redis and igbinary:
###########################################################################
ARG PHP_VERSION=8.1
ENV PHP_VERSION ${PHP_VERSION}
ARG INSTALL_REDIS=false
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a igbinary \
&& docker-php-ext-enable igbinary \
&& printf "yes\n" | pecl install redis \
&& docker-php-ext-enable redis \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# xDebug (termporary):
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug3/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
###########################################################################
# Libreoffice
###########################################################################
ARG INSTALL_LIBREOFFICE=false
ARG DEBIAN_FRONTEND=noninteractive
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
apt-get update \
&& apt-get install -y libreoffice-nogui --no-install-recommends \
&& apt-get clean \
;fi
###########################################################################
# Tune opts:
###########################################################################
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/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"
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=48M
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
INCLUDE+ ./php.base.Dockerfile

View File

@ -1,58 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/php:8.2
###########################################################################
# Redis and igbinary:
###########################################################################
ARG PHP_VERSION=8.2
ENV PHP_VERSION ${PHP_VERSION}
ARG INSTALL_REDIS=false
COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a igbinary \
&& docker-php-ext-enable igbinary \
&& printf "yes\n" | pecl install redis \
&& docker-php-ext-enable redis \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# xDebug (termporary):
###########################################################################
# Copy xdebug configuration for remote debugging
COPY ./xdebug3/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
###########################################################################
# Tune opts:
###########################################################################
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/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"
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=48M
RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini"
ARG PHP_OPT_UPLOAD_MAX_FILESIZE=16M
RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini"
###########################################################################
# Libreoffice:
###########################################################################
RUN apt-get update && apt-get install -y libreoffice-nogui --no-install-recommends && apt-get clean
INCLUDE+ ./php.base.Dockerfile

View File

@ -0,0 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/php:8.3
ARG PHP_VERSION=8.3
ENV PHP_VERSION ${PHP_VERSION}
INCLUDE+ ./php.base.Dockerfile

View File

@ -1,26 +0,0 @@
; NOTE: The actual xdebug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
;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

View File

@ -1,87 +0,0 @@
#! /bin/bash
# NOTE: At the moment, this has only been confirmed to work with PHP 7
PHP_VERSION=$2 # Without dot
WITH_PROFILER=$3
# Grab full name of php-fpm container
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
if [[ -z "${PHP_FPM_CONTAINER}" ]]; then
echo "Unable to find php fpm container: php${PHP_VERSION}"
exit 1
fi
if [[ ! -z "${WITH_PROFILER}" ]]; then
echo "With profiler option".
fi
xdebug_status ()
{
echo 'xDebug status'
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
xdebug_start ()
{
echo 'Start xDebug2'
# And uncomment line with xdebug extension, thus enabling it
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=0/xdebug.remote_autostart=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=0/xdebug.remote_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
PROFILER_ENABLE_CDM="sed -i 's/^xdebug.profiler_enable=0/xdebug.profiler_enable=1/g' /usr/local/etc/php/conf.d/xdebug.ini"
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
if [[ ! -z "${WITH_PROFILER}" ]]; then
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_ENABLE_CDM}"
fi
docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
xdebug_stop ()
{
echo 'Stop xDebug2'
# Comment out xdebug extension line
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
REMOTE_AUTOSTART_CMD="sed -i 's/^xdebug.remote_autostart=1/xdebug.remote_autostart=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
REMOTE_ENABLE_CMD="sed -i 's/^xdebug.remote_enable=1/xdebug.remote_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
PROFILER_DISABLE_CMD="sed -i 's/^xdebug.profiler_enable=1/xdebug.profiler_enable=0/g' /usr/local/etc/php/conf.d/xdebug.ini"
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_AUTOSTART_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${REMOTE_ENABLE_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${PROFILER_DISABLE_CMD}"
# docker-compose restart php-fpm
docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
case $1 in
stop|STOP)
xdebug_stop
;;
start|START)
xdebug_start
;;
status|STATUS)
xdebug_status
;;
*)
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
echo "xDebug must have already been installed."
echo "Usage:"
echo " .php-fpm/xdebug.sh 73|74 stop|start|status"
esac
exit 1

View File

@ -1,4 +0,0 @@
xdebug.mode=off
xdebug.discover_client_host=1
xdebug.start_with_request=yes
xdebug.output_dir=/tmp/profiler

View File

@ -1,84 +0,0 @@
#! /bin/bash
# NOTE: At the moment, this has only been confirmed to work with PHP 7
PHP_VERSION=$2 # Without dot
WITH_PROFILER=$3
# Grab full name of php-fpm container
PHP_FPM_CONTAINER=$(docker ps | grep php${PHP_VERSION} | awk '{print $1}')
if [[ -z "${PHP_FPM_CONTAINER}" ]]; then
echo "Unable to find php fpm container: php${PHP_VERSION}"
exit 1
fi
if [[ ! -z "${WITH_PROFILER}" ]]; then
echo "With profiler option".
fi
xdebug_status ()
{
echo 'xDebug status'
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
xdebug_start ()
{
echo 'Start xDebug3'
# And uncomment line with xdebug extension, thus enabling it
ON_CMD="sed -i 's/^;zend_extension=/zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
if [[ -n "${WITH_PROFILER}" ]]; then
XDEBUG_MODE='profile'
else
XDEBUG_MODE='debug'
fi
MODE_DEBUG_CMD="sed -i 's/^xdebug.mode.*/xdebug.mode=${XDEBUG_MODE}/g' /usr/local/etc/php/conf.d/xdebug.ini"
docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${MODE_DEBUG_CMD}"
docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
xdebug_stop ()
{
echo 'Stop xDebug3'
# Comment out xdebug extension line
OFF_CMD="sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
MODE_OFF_CMD="sed -i 's/^xdebug.mode.*/xdebug.mode=off/g' /usr/local/etc/php/conf.d/xdebug.ini"
docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}"
docker exec -it $PHP_FPM_CONTAINER bash -c "${MODE_OFF_CMD}"
# docker-compose restart php-fpm
docker restart $PHP_FPM_CONTAINER
docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v'
}
case $1 in
stop|STOP)
xdebug_stop
;;
start|START)
xdebug_start
;;
status|STATUS)
xdebug_status
;;
*)
echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container."
echo "xDebug must have already been installed."
echo "Usage:"
echo " .php-fpm/xdebug.sh 73|74 stop|start|status"
esac
exit 1

View File

@ -1,6 +0,0 @@
alias gst='git status'
alias ga='git add'
alias gc='git commit -m'
alias gush='git push'
alias gull='git pull'
alias gb='git branch'

View File

@ -1,3 +0,0 @@
/.bash_*
!/.bash_.example
/crontab

View File

@ -1 +0,0 @@
#* * * * * laradock /usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1

View File

@ -0,0 +1 @@
#* * * * * laradock /usr/bin/php /var/www/yourproject/artisan schedule:run >> /dev/null 2>&1

View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

@ -1,12 +0,0 @@
{
"version": "10",
"aliases": {
"local": {
"url": "http://minio:9000",
"accessKey": "s3.local",
"secretKey": "qbKTLqAumjYOYlCXCRk6",
"api": "S3v4",
"path": "auto"
}
}
}

View File

@ -0,0 +1,279 @@
###########################################################################
# Set custom timezone if needed
###########################################################################
ARG CUSTOM_TZ=Etc/UTC
RUN if [ ${CUSTOM_TZ} -ne $(cat /etc/timezone) ]; then \
ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && \
echo $CUSTOM_TZ > /etc/timezone \
;fi
###########################################################################
# Set additional locale if needed:
###########################################################################
ARG CUSTOM_LOCALE=en_US.UTF-8
RUN if [ ${CUSTOM_LOCALE} -ne 'en_US.UTF-8' ]; then \
locale-gen ${CUSTOM_LOCALE} \
;fi
###########################################################################
# Laradock non-root user:
###########################################################################
ARG CUSTOM_PUID=1000
ARG CUSTOM_PGID=1000
RUN if [ ${CUSTOM_PUID} -nq 1000 ]; then \
usermod -u ${CUSTOM_PUID} laradock \
;fi
RUN if [ ${CUSTOM_PGID} -nq 1000 ]; then \
groupmod -g ${CUSTOM_PGID} laradock \
chown -R :${CUSTOM_PGID} /home/laradock \
;fi
###########################################################################
# Update composer version if needed
###########################################################################
USER root
ARG COMPOSER_VERSION=2
RUN set -e; if [ ${COMPOSER_VERSION} -ne 2 ]; then \
composer self-update --${COMPOSER_VERSION}; \
mkdir -p ${HOME}/.composer; \
ln -s /run/secrets/composer_auth ${HOME}/.composer/auth.json; \
else \
mkdir -p ${HOME}/.config/composer; \
ln -s /run/secrets/composer_auth ${HOME}/.config/composer/auth.json; \
fi
###########################################################################
# WP CLI:
###########################################################################
# The command line interface for WordPress
USER root
ARG INSTALL_WP_CLI=false
RUN if [ ${INSTALL_WP_CLI} = true ]; then \
curl -fsSL -o /usr/local/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | bash && \
chmod +x /usr/local/bin/wp \
;fi
###########################################################################
# Pear Mail and Mail_Mime:
###########################################################################
ARG INSTALL_PEAR_MAIL=false
RUN if [ ${INSTALL_PEAR_MAIL} = true ]; then \
pear install Mail && pear install Mail_Mime \
;fi
###########################################################################
# Node / NVM:
###########################################################################
ARG INSTALL_NODE=false
ARG NODE_VERSION=v18.18.0
ENV NODE_VERSION ${NODE_VERSION}
USER laradock
ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \
mkdir -p $NVM_DIR && \
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \
&& . $NVM_DIR/nvm.sh \
;fi
# Wouldn't execute when added to the RUN statement in the above block
# Source NVM when loading bash since ~/.profile isn't loaded on non-login shell
RUN if [ ${INSTALL_NODE} = true ]; then \
echo "" >> ~/.bashrc && \
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
;fi
# Add NVM binaries to root's .bashrc
USER root
RUN if [ ${INSTALL_NODE} = true ]; then \
cp -R /home/laradock/.nvm /root/ && \
chown -R root:root /root/.nvm && \
echo "" >> ~/.bashrc && \
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
;fi
USER root
RUN if [ ${INSTALL_NODE} = true ]; then \
. ~/.bashrc && nvm install ${NODE_VERSION} \
&& . ~/.bashrc && nvm alias default ${NODE_VERSION} \
&& npm i -g yarn \
&& cp -R ~/.nvm/alias /home/laradock/.nvm \
&& cp -R ~/.nvm/versions /home/laradock/.nvm \
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \
;fi
###########################################################################
# APT
###########################################################################
# once please
RUN apt update -qq
###########################################################################
# YADM
###########################################################################
ARG INSTALL_YADM=true
USER root
RUN if [ ${INSTALL_YADM} = true ]; then \
apt-get install direnv yadm tmux -qq && \
curl -sS https://starship.rs/install.sh | sh -s -- -f && \
yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git \
;fi
USER laradock
RUN if [ ${INSTALL_YADM} = true ]; then \
yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git && \
sed -i 's/#/\\$/g' ${HOME}/.config/starship.toml \
;fi
###########################################################################
# FINE UTILS:
###########################################################################
USER root
RUN if [ ${INSTALL_FINE_UTILS} = true ]; then \
apt-get install htop -qq \
;fi
###########################################################################
# SUPERVISOR:
###########################################################################
USER root
ARG INSTALL_SUPERVISOR=false
RUN if [ ${INSTALL_SUPERVISOR} = true ]; then \
apt-get install supervisor -qq \
;fi
###########################################################################
# PYTHON & UVICORN:
###########################################################################
USER root
ARG INSTALL_PYTHON=false
RUN if [ ${INSTALL_PYTHON} = true ]; then \
apt-get install liblzma-dev libbz2-dev libffi-dev libreadline-dev zlib1g-dev -qq --no-install-recommends \
;fi
USER laradock
SHELL ["/bin/bash", "-c"]
ARG PYTHON_VERSION=3.12
ENV PYENV_VERSION=${PYTHON_VERSION}
RUN if [ ${INSTALL_PYTHON} = true ]; then \
set -e; \
curl https://pyenv.run | bash &&\
echo '' >> ~/.shell-env.local && \
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.shell-env.local && \
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.shell-env.local && \
echo 'eval "$(pyenv init -)"' >> ~/.shell-env.local && \
echo '' >> ~/.shell-env.local && \
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.shell-env.local && \
echo '' >> ~/.shell-env.local && \
$HOME/.pyenv/bin/pyenv install ${PYTHON_VERSION} \
;fi
RUN if [ ${INSTALL_PYTHON} = true ]; then \
bash -ic 'python -m pip install uvicorn' \
;fi
RUN if [ false = true ]; then \
python -m pip install uvicorn && \
python -m pip install --upgrade supervisor && \
echo_supervisord_conf > /etc/supervisord.conf && \
sed -i 's/\;\[include\]/\[include\]/g' /etc/supervisord.conf && \
sed -i 's/\;files\s.*/files = supervisord.d\/*.conf/g' /etc/supervisord.conf \
;fi
SHELL ["/bin/sh", "-c"]
###########################################################################
# Libreoffice
###########################################################################
USER root
ARG INSTALL_LIBREOFFICE=false
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
add-apt-repository -y ppa:libreoffice/ppa \
&& apt update -qq \
&& apt-get install libreoffice-nogui -qq --no-install-recommends \
;fi
###########################################################################
# НУЦ:
###########################################################################
USER root
ARG INSTALL_NUC_CERTS=false
RUN if [ ${INSTALL_NUC_CERTS} = true ]; then \
mkdir /usr/local/share/ca-certificates/extra && \
cd /usr/local/share/ca-certificates/extra && \
curl -O https://gu-st.ru/content/lending/russian_trusted_root_ca_pem.crt && \
curl -O https://gu-st.ru/content/lending/russian_trusted_sub_ca_pem.crt && \
update-ca-certificates \
;fi
###########################################################################
# Tune opts:
###########################################################################
USER root
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
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" /etc/php/${PHP_VERSION}/cli/php.ini
###########################################################################
# Cleanup & Crontab
###########################################################################
USER root
# Clean up
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY ./crontab/* /etc/cron.d/
RUN chmod -R 644 /etc/cron.d
#ENTRYPOINT ["/bin/bash","-c","service supervisor start"]

View File

@ -1,171 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/workspace:7.4
ARG PHP_VERSION=7.4
ENV PHP_VERSION ${PHP_VERSION}
###########################################################################
# Laradock non-root user:
###########################################################################
ARG CUSTOM_PUID=1000
ENV PUID ${CUSTOM_PUID}
ARG CUSTOM_PGID=1000
ENV PGID ${CUSTOM_PGID}
RUN usermod -u ${CUSTOM_PUID} laradock && groupmod -g ${CUSTOM_PGID} laradock
RUN chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock
###########################################################################
# Set Timezone
###########################################################################
ARG CUSTOM_TZ=Europe/Moscow
ENV TZ ${CUSTOM_TZ}
RUN ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && echo $CUSTOM_TZ > /etc/timezone
###########################################################################
# Additional PHP-extensions:
###########################################################################
#RUN pecl install igbinary && pecl install -a redis
RUN pecl install -a redis
RUN echo "extension=redis.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-redis.ini
###########################################################################
# S3 config
###########################################################################
USER laradock
COPY ./minio/auth.json /home/laradock/.mc/config.json
###########################################################################
# Install custom node version
###########################################################################
USER root
ARG NODE_VERSION
ENV NODE_VERSION ${NODE_VERSION}
RUN if [ ! -z "${NODE_VERSION}" ]; then \
. ~/.bashrc && nvm install ${NODE_VERSION} \
&& . ~/.bashrc && nvm alias default ${NODE_VERSION} \
&& npm i -g yarn \
&& cp -R ~/.nvm/alias /home/laradock/.nvm \
&& cp -R ~/.nvm/versions /home/laradock/.nvm \
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \
;fi
###########################################################################
# Update composer version
###########################################################################
USER root
ARG COMPOSER_VERSION=1
ENV COMPOSER_VERSION ${COMPOSER_VERSION}
RUN composer self-update # Need for correctly update to actual old branch
RUN composer self-update --${COMPOSER_VERSION}
###########################################################################
# YADM
###########################################################################
USER root
SHELL ["/bin/bash", "-c"]
# once please
RUN apt update
RUN apt install -y direnv yadm
RUN curl -sS https://starship.rs/install.sh | sh -s -- -f
USER laradock
RUN yadm clone --bootstrap https://vcs.wpstudio.ru/gitea/dotfiles.git
RUN sed -i 's/#/\\$/g' ${HOME}/.config/starship.toml
###########################################################################
# SUPERVISOR:
###########################################################################
USER root
ARG INSTALL_SUPERVISOR=false
RUN if [ ${INSTALL_SUPERVISOR} = true ]; then \
apt install -y supervisor \
;fi
RUN apt install -y liblzma-dev libbz2-dev libffi-dev libreadline-dev
USER laradock
RUN curl https://pyenv.run | bash
RUN echo '' >> ~/.shell-env.local && \
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.shell-env.local && \
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.shell-env.local && \
echo 'eval "$(pyenv init -)"' >> ~/.shell-env.local && \
echo '' >> ~/.shell-env.local && \
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.shell-env.local && \
echo '' >> ~/.shell-env.local
RUN $HOME/.pyenv/bin/pyenv install 3.9
ARG INSTALL_PYTHON=false
RUN if [ ${INSTALL_PYTHON} = true ]; then \
export PYENV_VERSION=3.9 && \
python -m pip install uvicorn \
;fi
RUN if [ false = true ]; then \
export PYENV_VERSION=3.9 && \
python -m pip install uvicorn && \
python -m pip install --upgrade supervisor && \
echo_supervisord_conf > /etc/supervisord.conf && \
sed -i 's/\;\[include\]/\[include\]/g' /etc/supervisord.conf && \
sed -i 's/\;files\s.*/files = supervisord.d\/*.conf/g' /etc/supervisord.conf \
;fi
USER root
RUN apt install -y htop
###########################################################################
# Tune opts:
###########################################################################
USER root
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" /etc/php/${PHP_VERSION}/cli/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" /etc/php/${PHP_VERSION}/cli/php.ini
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
###########################################################################
# Crontab
###########################################################################
USER root
# Clean up
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d
#ENTRYPOINT ["/bin/bash","-c","service supervisor start"]
INCLUDE+ ./workspace.base.Dockerfile

View File

@ -1,127 +1,7 @@
FROM dimti/workspace:8.1
# syntax = edrevo/dockerfile-plus
FROM dimti/workspace:8.2
ARG PHP_VERSION=8.1
ARG PHP_VERSION=8.2
ENV PHP_VERSION ${PHP_VERSION}
###########################################################################
# Laradock non-root user:
###########################################################################
ARG CUSTOM_PUID=1000
ENV PUID ${CUSTOM_PUID}
ARG CUSTOM_PGID=1000
ENV PGID ${CUSTOM_PGID}
RUN usermod -u ${CUSTOM_PUID} laradock && groupmod -g ${CUSTOM_PGID} laradock
RUN chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock
###########################################################################
# Set Timezone
###########################################################################
ARG CUSTOM_TZ=Europe/Moscow
ENV TZ ${CUSTOM_TZ}
RUN ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && echo $CUSTOM_TZ > /etc/timezone
###########################################################################
# Additional PHP-extensions:
###########################################################################
ARG INSTALL_REDIS=false
#RUN pecl install igbinary
RUN if [ ${INSTALL_REDIS} = true ]; then \
pecl install -a redis \
echo "extension=redis.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-redis.ini \
;fi
###########################################################################
# Libreoffice
###########################################################################
ARG INSTALL_LIBREOFFICE=false
ARG DEBIAN_FRONTEND=noninteractive
RUN if [ ${INSTALL_LIBREOFFICE} = true ]; then \
add-apt-repository ppa:libreoffice/ppa \
&& apt update \
&& apt install libreoffice-nogui -y --no-install-recommends \
&& apt clean \
;fi
###########################################################################
# S3 config
###########################################################################
USER laradock
COPY ./minio/auth.json /home/laradock/.mc/config.json
###########################################################################
# Install custom node version
###########################################################################
USER root
ARG NODE_VERSION
ENV NODE_VERSION ${NODE_VERSION}
RUN if [ ! -z "${NODE_VERSION}" ]; then \
. ~/.bashrc && nvm install ${NODE_VERSION} \
&& . ~/.bashrc && nvm alias default ${NODE_VERSION} \
&& npm i -g yarn \
&& cp -R ~/.nvm/alias /home/laradock/.nvm \
&& cp -R ~/.nvm/versions /home/laradock/.nvm \
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \
;fi
###########################################################################
# Update composer version
###########################################################################
USER root
ARG COMPOSER_VERSION=2
ENV COMPOSER_VERSION ${COMPOSER_VERSION}
RUN composer self-update --${COMPOSER_VERSION}
###########################################################################
# Laradock Aliases
###########################################################################
USER laradock
COPY ./aliases.sh /home/laradock/aliases.sh
RUN echo "" >> ~/.bashrc && \
echo "# Load Custom Aliases" >> ~/.bashrc && \
echo "source ~/aliases.sh" >> ~/.bashrc && \
echo "" >> ~/.bashrc
###########################################################################
# Tune opts:
###########################################################################
USER root
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" /etc/php/${PHP_VERSION}/cli/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" /etc/php/${PHP_VERSION}/cli/php.ini
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
###########################################################################
# Crontab
###########################################################################
USER root
COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d
INCLUDE+ ./workspace.base.Dockerfile

View File

@ -1,115 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/workspace:8.2
ARG PHP_VERSION=8.2
ENV PHP_VERSION ${PHP_VERSION}
###########################################################################
# Laradock non-root user:
###########################################################################
ARG CUSTOM_PUID=1000
ENV PUID ${CUSTOM_PUID}
ARG CUSTOM_PGID=1000
ENV PGID ${CUSTOM_PGID}
RUN usermod -u ${CUSTOM_PUID} laradock && groupmod -g ${CUSTOM_PGID} laradock
RUN chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock
###########################################################################
# Set Timezone
###########################################################################
ARG CUSTOM_TZ=Europe/Moscow
ENV TZ ${CUSTOM_TZ}
RUN ln -snf /usr/share/zoneinfo/$CUSTOM_TZ /etc/localtime && echo $CUSTOM_TZ > /etc/timezone
###########################################################################
# Additional PHP-extensions:
###########################################################################
#RUN pecl install igbinary && pecl install -a redis
RUN pecl install -a redis
RUN echo "extension=redis.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-redis.ini
###########################################################################
# S3 config
###########################################################################
USER laradock
COPY ./minio/auth.json /home/laradock/.mc/config.json
###########################################################################
# Install custom node version
###########################################################################
USER root
ARG NODE_VERSION
ENV NODE_VERSION ${NODE_VERSION}
RUN if [ ! -z "${NODE_VERSION}" ]; then \
. ~/.bashrc && nvm install ${NODE_VERSION} \
&& . ~/.bashrc && nvm alias default ${NODE_VERSION} \
&& npm i -g yarn \
&& cp -R ~/.nvm/alias /home/laradock/.nvm \
&& cp -R ~/.nvm/versions /home/laradock/.nvm \
&& chown -R ${CUSTOM_PUID}:${CUSTOM_PGID} /home/laradock/.nvm \
;fi
###########################################################################
# Update composer version
###########################################################################
USER root
ARG COMPOSER_VERSION=2
ENV COMPOSER_VERSION ${COMPOSER_VERSION}
RUN composer self-update --${COMPOSER_VERSION}
###########################################################################
# Laradock Aliases
###########################################################################
USER laradock
COPY ./aliases.sh /home/laradock/aliases.sh
RUN echo "" >> ~/.bashrc && \
echo "# Load Custom Aliases" >> ~/.bashrc && \
echo "source ~/aliases.sh" >> ~/.bashrc && \
echo "" >> ~/.bashrc
###########################################################################
# Tune opts:
###########################################################################
USER root
ARG PHP_OPT_SHORT_OPEN_TAG=Off
RUN sed -i "s/^short_open_tag = .*/short_open_tag = $PHP_OPT_SHORT_OPEN_TAG/g" /etc/php/${PHP_VERSION}/cli/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" /etc/php/${PHP_VERSION}/cli/php.ini
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
###########################################################################
# Crontab
###########################################################################
USER root
COPY ./crontab /etc/cron.d
RUN chmod -R 644 /etc/cron.d
###########################################################################
# Libreoffice:
###########################################################################
ARG DEBIAN_FRONTEND=noninteractive
RUN add-apt-repository ppa:libreoffice/ppa && apt update && apt install libreoffice-nogui -y --no-install-recommends && apt clean
INCLUDE+ ./workspace.base.Dockerfile

View File

@ -0,0 +1,7 @@
# syntax = edrevo/dockerfile-plus
FROM dimti/workspace:8.3
ARG PHP_VERSION=8.3
ENV PHP_VERSION ${PHP_VERSION}
INCLUDE+ ./workspace.base.Dockerfile

View File

@ -1,73 +0,0 @@
#! /bin/bash
# NOTE: At the moment, this has only been confirmed to work with PHP 7
PHP_VERSION=$2 # Without dot
WITH_PROFILER=$3
# Grab full name of workspace container
WORKSPACE_CONTAINER=$(docker ps | grep workspace${PHP_VERSION} | awk '{print $1}')
if [[ -z "${WORKSPACE_CONTAINER}" ]]; then
echo "Unable to find workspace container: workspace${PHP_VERSION}"
exit 1
fi
if [[ ! -z "${WITH_PROFILER}" ]]; then
echo "With profiler option".
fi
xdebug_status ()
{
echo 'xDebug status'
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
}
xdebug_start ()
{
echo 'Start xDebug'
# And uncomment line with xdebug extension, thus enabling it
ON_CMD='sed -i "s/^;zend_extension=/zend_extension=/g" /etc/php/$PHP_VERSION/cli/conf.d/20-xdebug.ini'
docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}"
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
echo 'In cli use this for resolve hostname for debugger in your IDE:'
echo 'export PHP_IDE_CONFIG="serverName=loc.mydomain.ru"'
}
xdebug_stop ()
{
echo 'Stop xDebug'
# Comment out xdebug extension line
OFF_CMD='sed -i "s/^zend_extension=/;zend_extension=/g" /etc/php/$PHP_VERSION/cli/conf.d/20-xdebug.ini'
docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}"
docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v'
}
case $1 in
stop|STOP)
xdebug_stop
;;
start|START)
xdebug_start
;;
status|STATUS)
xdebug_status
;;
*)
echo "xDebug [Stop | Start | Status] in the ${WORKSPACE_CONTAINER} container."
echo "xDebug must have already been installed."
echo "Usage:"
echo " .php-fpm/xdebug stop|start|status"
esac
exit 1