From f3139e97161eae416792921f30ed768f5f4dc122 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 13 Apr 2021 00:01:26 +0300 Subject: [PATCH] * big pre-summer refactoring + introduce php7.4 and stay only php7.3 as max older version + workspace with php7.4 in future commits --- .env.example | 7 +- README.md | 8 + config/nginx/conf.d/vhost.conf.example | 12 +- docker-compose.base.yml | 102 +++++ docker-compose.elastic.base.yml | 24 ++ docker-compose.elastic.yml | 24 ++ docker-compose.postgres.yml | 29 ++ docker-compose.sphinx.yml | 18 + docker-compose.yml.example | 219 +++------- dockerfiles/elasticsearch732/Dockerfile | 3 + dockerfiles/elasticsearch752/Dockerfile | 3 + dockerfiles/php-fpm/igbinary.ini | 9 + .../{Dockerfile => php-fpm.base.Dockerfile} | 101 ++--- dockerfiles/php-fpm/php-fpm73.Dockerfile | 4 + dockerfiles/php-fpm/php-fpm74.Dockerfile | 4 + dockerfiles/php-fpm/xdebug.sh | 3 +- dockerfiles/php7.1-fpm/Dockerfile | 127 ------ dockerfiles/php7.1-fpm/xdebug.ini | 25 -- dockerfiles/php7.1-fpm/xdebug.sh | 101 ----- dockerfiles/php7.4-fpm/Dockerfile | 104 ----- dockerfiles/{workspace => workspace73}/Dockerfile | 0 dockerfiles/{workspace => workspace73}/aliases.sh | 0 dockerfiles/{workspace => workspace73}/auth.json | 0 .../{workspace => workspace73}/composer.json | 0 .../{workspace => workspace73}/crontab/laradock | 0 dockerfiles/{workspace => workspace73}/xdebug.ini | 0 dockerfiles/{workspace => workspace73}/xdebug.sh | 0 dockerfiles/workspace74/Dockerfile | 475 +++++++++++++++++++++ dockerfiles/workspace74/aliases.sh | 153 +++++++ dockerfiles/workspace74/auth.json | 11 + dockerfiles/workspace74/composer.json | 5 + dockerfiles/workspace74/crontab/laradock | 1 + dockerfiles/{php7.4-fpm => workspace74}/xdebug.ini | 13 +- dockerfiles/{php7.4-fpm => workspace74}/xdebug.sh | 34 +- 34 files changed, 1013 insertions(+), 606 deletions(-) create mode 100644 README.md create mode 100755 docker-compose.base.yml create mode 100755 docker-compose.elastic.base.yml create mode 100755 docker-compose.elastic.yml create mode 100755 docker-compose.postgres.yml create mode 100755 docker-compose.sphinx.yml create mode 100644 dockerfiles/elasticsearch732/Dockerfile create mode 100644 dockerfiles/elasticsearch752/Dockerfile create mode 100644 dockerfiles/php-fpm/igbinary.ini rename dockerfiles/php-fpm/{Dockerfile => php-fpm.base.Dockerfile} (81%) create mode 100644 dockerfiles/php-fpm/php-fpm73.Dockerfile create mode 100644 dockerfiles/php-fpm/php-fpm74.Dockerfile delete mode 100644 dockerfiles/php7.1-fpm/Dockerfile delete mode 100644 dockerfiles/php7.1-fpm/xdebug.ini delete mode 100755 dockerfiles/php7.1-fpm/xdebug.sh delete mode 100644 dockerfiles/php7.4-fpm/Dockerfile rename dockerfiles/{workspace => workspace73}/Dockerfile (100%) rename dockerfiles/{workspace => workspace73}/aliases.sh (100%) rename dockerfiles/{workspace => workspace73}/auth.json (100%) rename dockerfiles/{workspace => workspace73}/composer.json (100%) rename dockerfiles/{workspace => workspace73}/crontab/laradock (100%) rename dockerfiles/{workspace => workspace73}/xdebug.ini (100%) rename dockerfiles/{workspace => workspace73}/xdebug.sh (100%) create mode 100644 dockerfiles/workspace74/Dockerfile create mode 100644 dockerfiles/workspace74/aliases.sh create mode 100644 dockerfiles/workspace74/auth.json create mode 100644 dockerfiles/workspace74/composer.json create mode 100644 dockerfiles/workspace74/crontab/laradock rename dockerfiles/{php7.4-fpm => workspace74}/xdebug.ini (61%) rename dockerfiles/{php7.4-fpm => workspace74}/xdebug.sh (61%) diff --git a/.env.example b/.env.example index 047774c..777745c 100644 --- a/.env.example +++ b/.env.example @@ -14,7 +14,7 @@ WORKSPACE_COMPOSER_REPO_PACKAGIST= WORKSPACE_INSTALL_WP_CLI=true WORKSPACE_INSTALL_XDEBUG=false WORKSPACE_INSTALL_SSH=true -WORKSPACE_SSH_PASSPHRAZE=RSfndC66KmuRPRtSXOEe +WORKSPACE_SSH_PASSPHRAZE= WORKSPACE_INSTALL_FSWATCH=false WORKSPACE_INSTALL_NODE=true WORKSPACE_NODE_VERSION=lts/dubnium @@ -25,14 +25,17 @@ WORKSPACE_INSTALL_GULP=true WORKSPACE_INSTALL_MYSQL_CLIENT=true WORKSPACE_INSTALL_PING=true WORKSPACE_INSTALL_PYTHON=true +WORKSPACE_INSTALL_S3_MINIO_CLIENT=true ### PHP-FPM ############################################# INSTALL_XDEBUG=true INSTALL_REDIS=true -INSTALL_PEAR_MAIL=true INSTALL_ZIP=true INSTALL_BZ2=true INSTALL_INTL=true +INSTALL_PGSQL=true +INSTALL_BCMATH=true +INSTALL_PEAR_MAIL=true PHP_OPT_SHORT_OPEN_TAG=On PHP_OPT_MAX_EXECUTION_TIME=600 PHP_OPT_MEMORY_LIMIT=500M diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e56b33 --- /dev/null +++ b/README.md @@ -0,0 +1,8 @@ +## Run docker build + +First. You need export environment variable +`export DOCKER_BUILDKIT=1` (more info https://github.com/edrevo/dockerfile-plus) + +## Database dumps + +Database dumps must be serve on `./hostfiles` directory. diff --git a/config/nginx/conf.d/vhost.conf.example b/config/nginx/conf.d/vhost.conf.example index a91220d..dfcc930 100644 --- a/config/nginx/conf.d/vhost.conf.example +++ b/config/nginx/conf.d/vhost.conf.example @@ -1,9 +1,9 @@ -upstream fpm { - server php-fpm:9000; +upstream php-fpm73 { + server php-fpm73:9000; } -upstream fpm7.1 { - server php7.1-fpm:9000; +upstream php-fpm74 { + server php-fpm74:9000; } map $http_host $root { @@ -20,7 +20,7 @@ server { include includes.d/octobercms.conf; include includes.d/staticfiles.conf; location ~ ^/index.php { - fastcgi_pass fpm; + fastcgi_pass php-fpm74; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } @@ -49,7 +49,7 @@ server { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; - fastcgi_pass fpm; + fastcgi_pass php-fpm73; fastcgi_index index.php; } } \ No newline at end of file diff --git a/docker-compose.base.yml b/docker-compose.base.yml new file mode 100755 index 0000000..2e1dc78 --- /dev/null +++ b/docker-compose.base.yml @@ -0,0 +1,102 @@ +version: '3.6' + +services: + nginx: + image: nginx + restart: always + networks: + default: + aliases: + - loc.10ballov + volumes: + - ${PROJECTS_DIR}:/usr/share/nginx/html + - ./config/nginx/conf.d:/etc/nginx/conf.d + - ./config/nginx/includes.d:/etc/nginx/includes.d + - ./log/nginx:/var/log/nginx + ports: + - "80:80" + - "443:443" + expose: + - 80 + + php-fpm: + build: + context: ./dockerfiles/php-fpm + args: + - INSTALL_XDEBUG=${INSTALL_XDEBUG} + - INSTALL_REDIS=${INSTALL_REDIS} + - INSTALL_ZIP=${INSTALL_ZIP} + - INSTALL_BZ2=${INSTALL_BZ2} + - INSTALL_INTL=${INSTALL_INTL} + - INSTALL_PGSQL=${INSTALL_PGSQL} + - INSTALL_BCMATH=${INSTALL_BCMATH} + - INSTALL_PEAR_MAIL=${INSTALL_PEAR_MAIL} + - PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG} + - PHP_OPT_MAX_EXECUTION_TIME=${PHP_OPT_MAX_EXECUTION_TIME} + - PHP_OPT_MEMORY_LIMIT=${PHP_OPT_MEMORY_LIMIT} + - PHP_OPT_UPLOAD_MAX_FILESIZE=${PHP_OPT_UPLOAD_MAX_FILESIZE} + restart: always + volumes: + - ${PROJECTS_DIR}:/usr/share/nginx/html + expose: + - 9000 + + workspace: + build: + context: ./dockerfiles/workspace + args: + - PHP_VERSION=${WORKSPACE_PHP_VERSION} + - PUID=${WORKSPACE_PUID} + - PGID=${WORKSPACE_PGID} + - TZ=${WORKSPACE_TIMEZONE} + - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL} + - COMPOSER_AUTH=${WORKSPACE_COMPOSER_AUTH} + - COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST} + - INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI} + - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG} + - INSTALL_SSH=${WORKSPACE_INSTALL_SSH} + - SSH_PASSPHRAZE=${WORKSPACE_SSH_PASSPHRAZE} + - INSTALL_FSWATCH=${WORKSPACE_INSTALL_FSWATCH} + - INSTALL_NODE=${WORKSPACE_INSTALL_NODE} + - NODE_VERSION=${WORKSPACE_NODE_VERSION} + - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} + - INSTALL_YARN=${WORKSPACE_INSTALL_YARN} + - YARN_VERSION=${WORKSPACE_YARN_VERSION} + - INSTALL_GULP=${WORKSPACE_INSTALL_GULP} + - INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT} + - INSTALL_PING=${WORKSPACE_INSTALL_PING} + - INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON} + restart: always + volumes: + - ${PROJECTS_DIR}:/var/www + extra_hosts: + - "dockerhost:${DOCKER_HOST_IP}" + + db: + image: mariadb + restart: always + environment: + MYSQL_ROOT_PASSWORD: 123456 + volumes: + - database:/var/lib/mysql + - ./hostfiles:/hostfiles + ports: + - "3306:3306" + + pma: + image: phpmyadmin/phpmyadmin + restart: always + environment: + PMA_HOST: db + PMA_USER: root + PMA_PASSWORD: 123456 + ports: + - "81:80" + + redis: + image: redis + restart: always + command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ] + volumes: + - ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf + diff --git a/docker-compose.elastic.base.yml b/docker-compose.elastic.base.yml new file mode 100755 index 0000000..83afe2a --- /dev/null +++ b/docker-compose.elastic.base.yml @@ -0,0 +1,24 @@ +version: '3.6' + +services: + elasticsearch: + build: + context: ./dockerfiles/elasticsearch + restart: on-failure + environment: + - discovery.type=single-node + - "ES_JAVA_OPTS=-Xms512m -Xmx512m" + ulimits: + memlock: + soft: -1 + hard: -1 + mem_limit: 2g + volumes: + - elastic:/usr/share/elasticsearch/data + expose: + - "9200" + - "9300" + +# Must be copied into main docker-compose yml-file +volumes: + elastic: diff --git a/docker-compose.elastic.yml b/docker-compose.elastic.yml new file mode 100755 index 0000000..a69da14 --- /dev/null +++ b/docker-compose.elastic.yml @@ -0,0 +1,24 @@ +version: '3.6' + +services: + elasticsearch752: + extends: + file: docker-compose.elasticsearch.base.yml + service: elasticsearch + build: + context: ./dockerfiles/elasticsearch752 + volumes: + - elastic752:/usr/share/elasticsearch/data + + elasticsearch732: + extends: + file: docker-compose.elasticsearch.base.yml + service: elasticsearch + build: + context: ./dockerfiles/elasticsearch732 + volumes: + - elastic732:/usr/share/elasticsearch/data + +volumes: + elastic752: + elastic732: diff --git a/docker-compose.postgres.yml b/docker-compose.postgres.yml new file mode 100755 index 0000000..2468846 --- /dev/null +++ b/docker-compose.postgres.yml @@ -0,0 +1,29 @@ +version: '3.6' + +services: + dbpg: + image: postgres + restart: always + environment: + POSTGRES_PASSWORD: postgres + volumes: + - databasepg:/var/lib/postgresql/data + - ./hostfiles:/hostfiles + adminer: + image: adminer + restart: always + ports: + - 8080:8080 + pgadmin: + image: dpage/pgadmin4 + restart: always + environment: + PGADMIN_DEFAULT_EMAIL: info@wpstudio.ru + PGADMIN_DEFAULT_PASSWORD: postgres + ports: + - "83:80" + volumes: + - ./hostfiles/pgadmin:/var/lib/pgadmin + +volumes: + databasepg: diff --git a/docker-compose.sphinx.yml b/docker-compose.sphinx.yml new file mode 100755 index 0000000..eec1808 --- /dev/null +++ b/docker-compose.sphinx.yml @@ -0,0 +1,18 @@ +version: '3.6' + +services: + sphinx: + build: ./dockerfiles/sphinx + restart: always + depends_on: + - db + command: sh -c 'searchd -c /etc/sphinxsearch/sphinx.conf & sleep 10 && while true; do indexer --rotate --all; sleep 7200; done' + volumes: + - ./config/sphinx:/etc/sphinxsearch + - ./log/sphinx:/var/log/sphinxsearch + - sphinx:/var/lib/sphinx/data + expose: + - "9306" + +volumes: + sphinx: diff --git a/docker-compose.yml.example b/docker-compose.yml.example index dabdbad..6173765 100755 --- a/docker-compose.yml.example +++ b/docker-compose.yml.example @@ -1,172 +1,61 @@ -version: "2" +version: '3.6' services: - web: - image: nginx - restart: always - networks: - default: - aliases: - - loc.10ballov - volumes: - - ${PROJECTS_DIR}:/usr/share/nginx/html - - ./config/nginx/conf.d:/etc/nginx/conf.d - - ./config/nginx/includes.d:/etc/nginx/includes.d - - ./log/nginx:/var/log/nginx - ports: - - "80:80" - - "443:443" - expose: - - 80 - php-fpm: + nginx: + extends: + file: docker-compose.base.yml + service: nginx + + php-fpm73: + extends: + file: docker-compose.base.yml + service: php-fpm build: - context: ./dockerfiles/php-fpm - args: - - INSTALL_XDEBUG=${INSTALL_XDEBUG} - - INSTALL_REDIS=${INSTALL_REDIS} - - INSTALL_PEAR_MAIL=${INSTALL_PEAR_MAIL} - - INSTALL_ZIP=${INSTALL_ZIP} - - INSTALL_BZ2=${INSTALL_BZ2} - - INSTALL_INTL=${INSTALL_INTL} - - PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG} - - PHP_OPT_MAX_EXECUTION_TIME=${PHP_OPT_MAX_EXECUTION_TIME} - - PHP_OPT_MEMORY_LIMIT=${PHP_OPT_MEMORY_LIMIT} - - PHP_OPT_UPLOAD_MAX_FILESIZE=${PHP_OPT_UPLOAD_MAX_FILESIZE} - restart: always - volumes: - - ${PROJECTS_DIR}:/usr/share/nginx/html - - ./tmp/php-fpm:/tmp/profiling - expose: - - 9000 - php7.1-fpm: + context: ./dockerfiles/php-fpm73 + + php-fpm74: + extends: + file: docker-compose.base.yml + service: php-fpm build: - context: dockerfiles/php7.1-fpm - args: - - INSTALL_XDEBUG=${INSTALL_XDEBUG} - - INSTALL_REDIS=${INSTALL_REDIS} - - INSTALL_PEAR_MAIL=${INSTALL_PEAR_MAIL} - - INSTALL_ZIP=${INSTALL_ZIP} - - INSTALL_BZ2=${INSTALL_BZ2} - - INSTALL_INTL=${INSTALL_INTL} - - PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG} - - PHP_OPT_MAX_EXECUTION_TIME=${PHP_OPT_MAX_EXECUTION_TIME} - - PHP_OPT_MEMORY_LIMIT=${PHP_OPT_MEMORY_LIMIT} - - PHP_OPT_UPLOAD_MAX_FILESIZE=${PHP_OPT_UPLOAD_MAX_FILESIZE} - restart: always - volumes: - - ${PROJECTS_DIR}:/usr/share/nginx/html - expose: - - 9000 - workspace: + context: ./dockerfiles/php-fpm74 + + workspace73: + extends: + file: docker-compose.base.yml + service: workspace + build: + context: ./dockerfiles/workspace73 + + workspace74: + extends: + file: docker-compose.base.yml + service: workspace build: - context: ./dockerfiles/workspace - args: - - PHP_VERSION=${WORKSPACE_PHP_VERSION} - - PUID=${WORKSPACE_PUID} - - PGID=${WORKSPACE_PGID} - - TZ=${WORKSPACE_TIMEZONE} - - COMPOSER_VERSION=${WORKSPACE_COMPOSER_VERSION} - - COMPOSER_GLOBAL_INSTALL=${WORKSPACE_COMPOSER_GLOBAL_INSTALL} - - COMPOSER_AUTH=${WORKSPACE_COMPOSER_AUTH} - - COMPOSER_REPO_PACKAGIST=${WORKSPACE_COMPOSER_REPO_PACKAGIST} - - INSTALL_WP_CLI=${WORKSPACE_INSTALL_WP_CLI} - - INSTALL_XDEBUG=${WORKSPACE_INSTALL_XDEBUG} - - INSTALL_SSH=${WORKSPACE_INSTALL_SSH} - - SSH_PASSPHRAZE=${WORKSPACE_SSH_PASSPHRAZE} - - INSTALL_FSWATCH=${WORKSPACE_INSTALL_FSWATCH} - - INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - - NODE_VERSION=${WORKSPACE_NODE_VERSION} - - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} - - INSTALL_YARN=${WORKSPACE_INSTALL_YARN} - - YARN_VERSION=${WORKSPACE_YARN_VERSION} - - INSTALL_GULP=${WORKSPACE_INSTALL_GULP} - - INSTALL_MYSQL_CLIENT=${WORKSPACE_INSTALL_MYSQL_CLIENT} - - INSTALL_PING=${WORKSPACE_INSTALL_PING} - - INSTALL_PYTHON=${WORKSPACE_INSTALL_PYTHON} - restart: always - volumes: - - ${PROJECTS_DIR}:/var/www - extra_hosts: - - "dockerhost:${DOCKER_HOST_IP}" - sphinx: - build: ./dockerfiles/sphinx - restart: always - depends_on: - - db - command: sh -c 'searchd -c /etc/sphinxsearch/sphinx.conf & sleep 10 && while true; do indexer --rotate --all; sleep 7200; done' - volumes: - - /home/dimti/docker-compose-projects/structure/config/sphinx:/etc/sphinxsearch - - /home/dimti/docker-compose-projects/structure/data/sphinx:/var/lib/sphinx/data - - /home/dimti/docker-compose-projects/structure/log/sphinx:/var/log/sphinxsearch - expose: - - "9306" + context: ./dockerfiles/workspace74 + db: - build: ./dockerfiles/db - restart: always - environment: - MYSQL_ROOT_PASSWORD: 123456 - volumes: - - database:/var/lib/mysql - - ./hostfiles:/hostfiles - - ./config/mariadb:/etc/mysql/conf.d - - ./log/mariadb:/var/log/mariadb - ports: - - "3306:3306" - phpmyadmin: - image: phpmyadmin/phpmyadmin - restart: always - environment: - PMA_HOST: db - PMA_USER: root - PMA_PASSWORD: 123456 - ports: - - "81:80" - dbpg: - image: postgres - restart: always - environment: - POSTGRES_PASSWORD: postgres - volumes: - - databasepg:/var/lib/postgresql/data - - /data/hostfiles:/hostfiles - adminer: - image: adminer - restart: always - ports: - - 8080:8080 - pgadmin: - image: dpage/pgadmin4 - restart: always - environment: - PGADMIN_DEFAULT_EMAIL: info@wpstudio.ru - PGADMIN_DEFAULT_PASSWORD: postgres - ports: - - "83:80" - volumes: - - /data/hostfiles/pgadmin:/var/lib/pgadmin + extends: + file: docker-compose.base.yml + service: db + + pma: + extends: + file: docker-compose.base.yml + service: pma + redis: - image: redis - restart: always - command: [ "redis-server", "/usr/local/etc/redis/redis.conf" ] - volumes: - - ./config/redis/redis.conf:/usr/local/etc/redis/redis.conf - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:7.5.2 - restart: always - container_name: elasticsearch - environment: - - discovery.type=single-node - - "ES_JAVA_OPTS=-Xms512m -Xmx512m" - ulimits: - memlock: - soft: -1 - hard: -1 - mem_limit: 2g - volumes: - - esdata1:/usr/share/elasticsearch/data - expose: - - "9200" - - "9300" -volumes: - database: - esdata1: + extends: + file: docker-compose.base.yml + service: redis + + redis-salvoterra: + extends: + file: docker-compose.base.yml + service: redis + restart: on-failure + + redis-allislam: + extends: + file: docker-compose.base.yml + service: redis diff --git a/dockerfiles/elasticsearch732/Dockerfile b/dockerfiles/elasticsearch732/Dockerfile new file mode 100644 index 0000000..acf321c --- /dev/null +++ b/dockerfiles/elasticsearch732/Dockerfile @@ -0,0 +1,3 @@ +FROM docker.elastic.co/elasticsearch/elasticsearch:7.3.2 + +RUN elasticsearch-plugin install analysis-icu diff --git a/dockerfiles/elasticsearch752/Dockerfile b/dockerfiles/elasticsearch752/Dockerfile new file mode 100644 index 0000000..7972d96 --- /dev/null +++ b/dockerfiles/elasticsearch752/Dockerfile @@ -0,0 +1,3 @@ +FROM docker.elastic.co/elasticsearch/elasticsearch:7.5.2 + +RUN elasticsearch-plugin install analysis-icu diff --git a/dockerfiles/php-fpm/igbinary.ini b/dockerfiles/php-fpm/igbinary.ini new file mode 100644 index 0000000..d64b9f9 --- /dev/null +++ b/dockerfiles/php-fpm/igbinary.ini @@ -0,0 +1,9 @@ +; 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 diff --git a/dockerfiles/php-fpm/Dockerfile b/dockerfiles/php-fpm/php-fpm.base.Dockerfile similarity index 81% rename from dockerfiles/php-fpm/Dockerfile rename to dockerfiles/php-fpm/php-fpm.base.Dockerfile index 68d96b8..eff310e 100644 --- a/dockerfiles/php-fpm/Dockerfile +++ b/dockerfiles/php-fpm/php-fpm.base.Dockerfile @@ -1,4 +1,3 @@ -FROM php:7.3-fpm RUN apt-get update && apt-get install -y \ libfreetype6-dev \ libjpeg62-turbo-dev \ @@ -10,12 +9,16 @@ RUN apt-get update && apt-get install -y \ && docker-php-ext-install mysqli \ && docker-php-ext-enable mysqli -RUN apt-get update && docker-php-ext-install pdo pdo_mysql && docker-php-ext-enable pdo pdo_mysql +RUN apt-get update && docker-php-ext-install pdo pdo_mysql \ + && docker-php-ext-enable pdo pdo_mysql ########################################################################### # xDebug: ########################################################################### +# Copy xdebug configuration for remote debugging +COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini + ARG INSTALL_XDEBUG=false RUN if [ ${INSTALL_XDEBUG} = true ]; then \ @@ -23,30 +26,25 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ pecl install xdebug-2.5.5; \ else \ - pecl install xdebug; \ + pecl install xdebug-2.9.8; \ fi && \ docker-php-ext-enable xdebug && \ sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ ;fi -# Copy xdebug configuration for remote debugging -COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini - -RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini - - ########################################################################### # Redis and igbinary: ########################################################################### ARG INSTALL_REDIS=false +COPY ./igbinary.ini /usr/local/etc/php/conf.d/igbinary.ini + RUN if [ ${INSTALL_REDIS} = true ]; then \ - pecl install igbinary \ - && pecl install -a redis \ - && docker-php-ext-enable igbinary redis \ + pecl install -a igbinary \ + && docker-php-ext-enable igbinary \ + && printf "yes\n" | pecl install redis \ + && docker-php-ext-enable redis \ ;fi ########################################################################### @@ -62,17 +60,7 @@ RUN if [ ${INSTALL_ZIP} = true ]; then \ ;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 - -########################################################################### -# BZ2 function: +# BZ2: ########################################################################### ARG INSTALL_BZ2=false @@ -84,7 +72,7 @@ RUN if [ ${INSTALL_BZ2} = true ]; then \ ;fi ########################################################################### -# INTL function: +# INTL: ########################################################################### ARG INSTALL_INTL=false @@ -96,6 +84,38 @@ RUN if [ ${INSTALL_INTL} = true ]; then \ ;fi ########################################################################### +# PGSQL: +########################################################################### + +ARG INSTALL_PGSQL=false + +RUN if [ ${INSTALL_PGSQL} = true ]; then \ + apt update && apt install -y libpq-dev \ + && docker-php-ext-install pgsql \ + && docker-php-ext-install pdo_pgsql \ +;fi + +########################################################################### +# BCMATH: +########################################################################### + +ARG INSTALL_BCMATH=false + +RUN if [ ${INSTALL_BCMATH} = true ]; then \ + && docker-php-ext-install bcmath \ +;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 + +########################################################################### # php.ini opts: ########################################################################### @@ -103,19 +123,15 @@ RUN if [ ${INSTALL_INTL} = true ]; then \ RUN mv "$PHP_INI_DIR/php.ini-development" "$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" ARG PHP_OPT_MAX_EXECUTION_TIME=30 - 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=128M - RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M - RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" @@ -127,24 +143,11 @@ RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MA RUN sed -i "s/^log_limit = .*/log_limit = 1024/g" "$PHP_INI_DIR/../php-fpm.d/docker.conf" ########################################################################### -# BCMATH functions: -########################################################################### - -RUN docker-php-ext-install bcmath && docker-php-ext-enable bcmath - -########################################################################### -# GEOIP: -########################################################################### - -RUN apt update \ - && apt install -y libgeoip-dev wget \ - && rm -rf /var/lib/apt/lists/* \ - && pecl install geoip-1.1.1 \ - && docker-php-ext-enable geoip - -########################################################################### -# PGSQL: +# Locales: ########################################################################### -RUN apt-get update && apt install -y libpq-dev \ - && docker-php-ext-install pdo_pgsql && docker-php-ext-enable pdo_pgsql +RUN apt update && \ + apt install -y locales && \ + sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + sed -i 's/# ru_RU.UTF-8 UTF-8/ru_RU.UTF-8 UTF-8/' /etc/locale.gen && \ + locale-gen \ No newline at end of file diff --git a/dockerfiles/php-fpm/php-fpm73.Dockerfile b/dockerfiles/php-fpm/php-fpm73.Dockerfile new file mode 100644 index 0000000..3f41f76 --- /dev/null +++ b/dockerfiles/php-fpm/php-fpm73.Dockerfile @@ -0,0 +1,4 @@ +# syntax = edrevo/dockerfile-plus +FROM php:7.3-fpm + +INCLUDE+ ./php-fpm.base.Dockerfile \ No newline at end of file diff --git a/dockerfiles/php-fpm/php-fpm74.Dockerfile b/dockerfiles/php-fpm/php-fpm74.Dockerfile new file mode 100644 index 0000000..bc9929a --- /dev/null +++ b/dockerfiles/php-fpm/php-fpm74.Dockerfile @@ -0,0 +1,4 @@ +# syntax = edrevo/dockerfile-plus +FROM php:7.4-fpm + +INCLUDE+ ./php-fpm.base.Dockerfile \ No newline at end of file diff --git a/dockerfiles/php-fpm/xdebug.sh b/dockerfiles/php-fpm/xdebug.sh index 8e43202..9b638c0 100755 --- a/dockerfiles/php-fpm/xdebug.sh +++ b/dockerfiles/php-fpm/xdebug.sh @@ -2,9 +2,10 @@ # NOTE: At the moment, this has only been confirmed to work with PHP 7 +PHP_VERSION=$1 # Grab full name of php-fpm container -PHP_FPM_CONTAINER=$(docker ps | grep php-fpm | awk '{print $1}') +PHP_FPM_CONTAINER=$(docker ps | grep php-fpm${PHP_VERSION} | awk '{print $1}') # Grab OS type diff --git a/dockerfiles/php7.1-fpm/Dockerfile b/dockerfiles/php7.1-fpm/Dockerfile deleted file mode 100644 index a371c68..0000000 --- a/dockerfiles/php7.1-fpm/Dockerfile +++ /dev/null @@ -1,127 +0,0 @@ -FROM php:7.1-fpm -RUN apt-get update && apt-get install -y \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libpng-dev \ - libwebp-dev \ - && docker-php-ext-install -j$(nproc) iconv \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-webp-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) gd \ - && docker-php-ext-install mysqli \ - && docker-php-ext-enable mysqli - -RUN apt-get update && docker-php-ext-install pdo pdo_mysql && docker-php-ext-enable pdo pdo_mysql - -########################################################################### -# xDebug: -########################################################################### - -ARG INSTALL_XDEBUG=false - -RUN if [ ${INSTALL_XDEBUG} = true ]; then \ - # Install the xdebug extension - if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install xdebug-2.5.5; \ - else \ - pecl install xdebug; \ - fi && \ - docker-php-ext-enable xdebug && \ - sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ -;fi - -# Copy xdebug configuration for remote debugging -COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini - -RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini - - -########################################################################### -# Redis and igbinary: -########################################################################### - -ARG INSTALL_REDIS=false - -RUN if [ ${INSTALL_REDIS} = true ]; then \ - pecl install igbinary \ - && pecl install -a redis \ - && docker-php-ext-enable igbinary redis \ -;fi - -########################################################################### -# Zip: -########################################################################### - -ARG INSTALL_ZIP=false - -RUN if [ ${INSTALL_ZIP} = true ]; then \ - apt update && apt install -y libzip-dev \ - && docker-php-ext-install zip \ - && docker-php-ext-enable zip \ -;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 - -########################################################################### -# BZ2 function: -########################################################################### - -ARG INSTALL_BZ2=false - -RUN if [ ${INSTALL_BZ2} = true ]; then \ - apt update && apt install -y libbz2-ocaml-dev \ - && docker-php-ext-install bz2 \ - && docker-php-ext-enable bz2 \ -;fi - -########################################################################### -# INTL function: -########################################################################### - -ARG INSTALL_INTL=false - -RUN if [ ${INSTALL_INTL} = true ]; then \ - apt update && apt install -y libicu-dev \ - && docker-php-ext-install intl \ - && docker-php-ext-enable intl \ -;fi - -########################################################################### -# 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" - -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=30 - -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=128M - -RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" - -ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M - -RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" - - -########################################################################### -# 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" diff --git a/dockerfiles/php7.1-fpm/xdebug.ini b/dockerfiles/php7.1-fpm/xdebug.ini deleted file mode 100644 index b719ba9..0000000 --- a/dockerfiles/php7.1-fpm/xdebug.ini +++ /dev/null @@ -1,25 +0,0 @@ -; NOTE: The actual debug.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=0 -xdebug.remote_enable=0 -xdebug.cli_color=0 -xdebug.profiler_enable=1 -xdebug.profiler_enable_trigger=1 -xdebug.profiler_output_dir=/tmp - -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 -xdebug.trace_output_name="trace.%t" - diff --git a/dockerfiles/php7.1-fpm/xdebug.sh b/dockerfiles/php7.1-fpm/xdebug.sh deleted file mode 100755 index 96c6dc3..0000000 --- a/dockerfiles/php7.1-fpm/xdebug.sh +++ /dev/null @@ -1,101 +0,0 @@ -#! /bin/bash - -# NOTE: At the moment, this has only been confirmed to work with PHP 7 - - -# Grab full name of php-fpm container -PHP_FPM_CONTAINER=$(docker ps | grep php7.1-fpm | awk '{print $1}') - - -# Grab OS type -if [[ "$(uname)" == "Darwin" ]]; then - OS_TYPE="OSX" -else - OS_TYPE=$(expr substr $(uname -s) 1 5) -fi - - -xdebug_status () -{ - echo 'xDebug status' - - # If running on Windows, need to prepend with winpty :( - if [[ $OS_TYPE == "MINGW" ]]; then - winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' - - else - docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' - fi - -} - - -xdebug_start () -{ - echo 'Start xDebug' - - # 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 running on Windows, need to prepend with winpty :( - if [[ $OS_TYPE == "MINGW" ]]; then - winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" - docker restart $PHP_FPM_CONTAINER - winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' - - else - docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" - docker restart $PHP_FPM_CONTAINER - docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' - fi -} - - -xdebug_stop () -{ - echo 'Stop xDebug' - - # 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" - - - # If running on Windows, need to prepend with winpty :( - if [[ $OS_TYPE == "MINGW" ]]; then - # This is the equivalent of: - # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' - # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593 - winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" - docker restart $PHP_FPM_CONTAINER - #docker-compose restart php-fpm - winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' - - else - docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" - # docker-compose restart php-fpm - docker restart $PHP_FPM_CONTAINER - docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' - fi -} - - -case $@ 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 stop|start|status" - -esac - -exit 1 diff --git a/dockerfiles/php7.4-fpm/Dockerfile b/dockerfiles/php7.4-fpm/Dockerfile deleted file mode 100644 index 577ed8c..0000000 --- a/dockerfiles/php7.4-fpm/Dockerfile +++ /dev/null @@ -1,104 +0,0 @@ -FROM php:7.4-fpm -RUN apt-get update && apt-get install -y \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libpng-dev \ - libwebp-dev \ - && docker-php-ext-install -j$(nproc) iconv \ - && docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp \ - && docker-php-ext-install -j$(nproc) gd \ - && docker-php-ext-install mysqli \ - && docker-php-ext-enable mysqli - -RUN apt-get update && docker-php-ext-install pdo pdo_mysql && docker-php-ext-enable pdo pdo_mysql - -########################################################################### -# xDebug: -########################################################################### - -ARG INSTALL_XDEBUG=false - -RUN if [ ${INSTALL_XDEBUG} = true ]; then \ - # Install the xdebug extension - if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install xdebug-2.5.5; \ - else \ - pecl install xdebug; \ - fi && \ - docker-php-ext-enable xdebug && \ - sed -i 's/^zend_extension=/;zend_extension=/g' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \ -;fi - -# Copy xdebug configuration for remote debugging -COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini - -RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /usr/local/etc/php/conf.d/xdebug.ini && \ - sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /usr/local/etc/php/conf.d/xdebug.ini - -########################################################################### -# Zip: -########################################################################### - -ARG INSTALL_ZIP=false - -RUN if [ ${INSTALL_ZIP} = true ]; then \ - apt update && apt install -y libzip-dev \ - && docker-php-ext-install zip \ - && docker-php-ext-enable zip \ -;fi - -########################################################################### -# BZ2 function: -########################################################################### - -ARG INSTALL_BZ2=false - -RUN if [ ${INSTALL_BZ2} = true ]; then \ - apt update && apt install -y libbz2-ocaml-dev \ - && docker-php-ext-install bz2 \ - && docker-php-ext-enable bz2 \ -;fi - -########################################################################### -# INTL function: -########################################################################### - -ARG INSTALL_INTL=false - -RUN if [ ${INSTALL_INTL} = true ]; then \ - apt update && apt install -y libicu-dev \ - && docker-php-ext-install intl \ - && docker-php-ext-enable intl \ -;fi - -########################################################################### -# 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" - -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=30 - -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=128M - -RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" - -ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M - -RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" - - -########################################################################### -# 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" diff --git a/dockerfiles/workspace/Dockerfile b/dockerfiles/workspace73/Dockerfile similarity index 100% rename from dockerfiles/workspace/Dockerfile rename to dockerfiles/workspace73/Dockerfile diff --git a/dockerfiles/workspace/aliases.sh b/dockerfiles/workspace73/aliases.sh similarity index 100% rename from dockerfiles/workspace/aliases.sh rename to dockerfiles/workspace73/aliases.sh diff --git a/dockerfiles/workspace/auth.json b/dockerfiles/workspace73/auth.json similarity index 100% rename from dockerfiles/workspace/auth.json rename to dockerfiles/workspace73/auth.json diff --git a/dockerfiles/workspace/composer.json b/dockerfiles/workspace73/composer.json similarity index 100% rename from dockerfiles/workspace/composer.json rename to dockerfiles/workspace73/composer.json diff --git a/dockerfiles/workspace/crontab/laradock b/dockerfiles/workspace73/crontab/laradock similarity index 100% rename from dockerfiles/workspace/crontab/laradock rename to dockerfiles/workspace73/crontab/laradock diff --git a/dockerfiles/workspace/xdebug.ini b/dockerfiles/workspace73/xdebug.ini similarity index 100% rename from dockerfiles/workspace/xdebug.ini rename to dockerfiles/workspace73/xdebug.ini diff --git a/dockerfiles/workspace/xdebug.sh b/dockerfiles/workspace73/xdebug.sh similarity index 100% rename from dockerfiles/workspace/xdebug.sh rename to dockerfiles/workspace73/xdebug.sh diff --git a/dockerfiles/workspace74/Dockerfile b/dockerfiles/workspace74/Dockerfile new file mode 100644 index 0000000..e9582f0 --- /dev/null +++ b/dockerfiles/workspace74/Dockerfile @@ -0,0 +1,475 @@ +# +#-------------------------------------------------------------------------- +# Image Setup +#-------------------------------------------------------------------------- +# +# To edit the 'workspace' base Image, visit its repository on Github +# https://github.com/Laradock/workspace +# +# To change its version, see the available Tags on the Docker Hub: +# https://hub.docker.com/r/laradock/workspace/tags/ +# +# Note: Base Image name format {image-tag}-{php-version} +# + +ARG PHP_VERSION + +# FROM laradock/workspace:2.2-${PHP_VERSION} +FROM letsdockerize/laradock-workspace:2.4-${PHP_VERSION} + +LABEL maintainer="WP Studio " + +# Set Environment Variables +ENV DEBIAN_FRONTEND noninteractive + +# Start as root +USER root + +########################################################################### +# Laradock non-root user: +########################################################################### + +# Add a non-root user to prevent files being created with root permissions on host machine. +ARG PUID=1000 +ENV PUID ${PUID} +ARG PGID=1000 +ENV PGID ${PGID} + +# always run apt update when start and after add new source list, then clean up at end. +RUN set -xe; \ + apt-get update -yqq && \ + pecl channel-update pecl.php.net && \ + groupadd -g ${PGID} laradock && \ + useradd -u ${PUID} -g laradock -m laradock -G docker_env && \ + usermod -p "*" laradock -s /bin/bash && \ + apt-get install -yqq \ + apt-utils \ + # + #-------------------------------------------------------------------------- + # Mandatory Software's Installation + #-------------------------------------------------------------------------- + # + # Mandatory Software's such as ("php-cli", "git", "vim", ....) are + # installed on the base image 'laradock/workspace' image. If you want + # to add more Software's or remove existing one, you need to edit the + # base image (https://github.com/Laradock/workspace). + # + # next lines are here becase there is no auto build on dockerhub see https://github.com/laradock/laradock/pull/1903#issuecomment-463142846 + libzip-dev zip unzip \ + # Install the zip extension + php${PHP_VERSION}-zip \ + # nasm + nasm && \ + php -m | grep -q 'zip' + +# +#-------------------------------------------------------------------------- +# Optional Software's Installation +#-------------------------------------------------------------------------- +# +# Optional Software's will only be installed if you set them to `true` +# in the `docker-compose.yml` before the build. +# Example: +# - WORKSPACE_INSTALL_NODE=false +# - ... +# + +########################################################################### +# Set Timezone +########################################################################### + +ARG TZ=Europe/Moscow +ENV TZ ${TZ} + +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +########################################################################### +# User Aliases +########################################################################### + +USER root + +COPY ./aliases.sh /root/aliases.sh +COPY ./aliases.sh /home/laradock/aliases.sh + +RUN sed -i 's/\r//' /root/aliases.sh && \ + sed -i 's/\r//' /home/laradock/aliases.sh && \ + chown laradock:laradock /home/laradock/aliases.sh && \ + echo "" >> ~/.bashrc && \ + echo "# Load Custom Aliases" >> ~/.bashrc && \ + echo "source ~/aliases.sh" >> ~/.bashrc && \ + echo "" >> ~/.bashrc + +USER laradock + +RUN echo "" >> ~/.bashrc && \ + echo "# Load Custom Aliases" >> ~/.bashrc && \ + echo "source ~/aliases.sh" >> ~/.bashrc && \ + echo "" >> ~/.bashrc + +########################################################################### +# MySQL Client: +########################################################################### + +USER root + +ARG INSTALL_MYSQL_CLIENT=false + +RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \ + apt-get update -yqq && \ + apt-get -y install mysql-client \ +;fi + +########################################################################### +# Composer: +########################################################################### + +USER root + +# Add the composer.json +COPY ./composer.json /home/laradock/.composer/composer.json + +# Add the auth.json for magento 2 credentials +COPY ./auth.json /home/laradock/.composer/auth.json + +# Make sure that ~/.composer belongs to laradock +RUN chown -R laradock:laradock /home/laradock/.composer + +# Export composer vendor path +RUN echo "" >> ~/.bashrc && \ + echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bashrc + +# Update composer +ARG COMPOSER_VERSION=2 +ENV COMPOSER_VERSION ${COMPOSER_VERSION} +RUN composer self-update --${COMPOSER_VERSION} + +USER laradock + +# Check if global install need to be ran +ARG COMPOSER_GLOBAL_INSTALL=false +ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} + +RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ + # run the install + composer global install \ +;fi + +# Check if auth file is disabled +ARG COMPOSER_AUTH=false +ENV COMPOSER_AUTH ${COMPOSER_AUTH} + +RUN if [ ${COMPOSER_AUTH} = false ]; then \ + # remove the file + rm /home/laradock/.composer/auth.json \ +;fi + +ARG COMPOSER_REPO_PACKAGIST +ENV COMPOSER_REPO_PACKAGIST ${COMPOSER_REPO_PACKAGIST} + +RUN if [ ${COMPOSER_REPO_PACKAGIST} ]; then \ + composer config -g repo.packagist composer ${COMPOSER_REPO_PACKAGIST} \ +;fi + +# Export composer vendor path +RUN echo "" >> ~/.bashrc && \ + echo 'export PATH="~/.composer/vendor/bin:$PATH"' >> ~/.bashrc + +########################################################################### +# Non-root user : PHPUnit path +########################################################################### + +# add ./vendor/bin to non-root user's bashrc (needed for phpunit) +USER laradock + +RUN echo "" >> ~/.bashrc && \ + echo 'export PATH="/var/www/vendor/bin:$PATH"' >> ~/.bashrc + +########################################################################### +# Check PHP version: +########################################################################### + +RUN set -xe; php -v | head -n 1 | grep -q "PHP ${PHP_VERSION}." + +########################################################################### +# MySQL Client: +########################################################################### + +USER root + +ARG INSTALL_MYSQL_CLIENT=false + +RUN if [ ${INSTALL_MYSQL_CLIENT} = true ]; then \ + apt-get update -yqq && \ + apt-get -y install mysql-client \ +;fi + +########################################################################### +# ping: +########################################################################### + +USER root + +ARG INSTALL_PING=false + +RUN if [ ${INSTALL_PING} = true ]; then \ + apt-get update -yqq && \ + apt-get -y install inetutils-ping \ +;fi + +########################################################################### +# PYTHON: +########################################################################### + +ARG INSTALL_PYTHON=false + +RUN if [ ${INSTALL_PYTHON} = true ]; then \ + apt-get -y install python python-pip python-dev build-essential \ + && python -m pip install --upgrade "pip < 21.0" \ + && python -m pip install --upgrade virtualenv \ +;fi + +########################################################################### +# Crontab +########################################################################### + +USER root + +COPY ./crontab /etc/cron.d + +RUN chmod -R 644 /etc/cron.d + +########################################################################### +# 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 + +########################################################################### +# xDebug: +########################################################################### + +USER root + +ARG INSTALL_XDEBUG=false + +RUN if [ ${INSTALL_XDEBUG} = true ]; then \ + # Load the xdebug extension only with phpunit commands + apt-get install -y php${PHP_VERSION}-xdebug && \ + sed -i 's/^;//g' /etc/php/${PHP_VERSION}/cli/conf.d/20-xdebug.ini && \ + echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/vendor/bin/phpunit'" >> ~/.bashrc \ +;fi + +# ADD for REMOTE debugging +COPY ./xdebug.ini /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini + +RUN sed -i "s/xdebug.remote_autostart=0/xdebug.remote_autostart=1/" /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug.remote_enable=0/xdebug.remote_enable=1/" /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini && \ + sed -i "s/xdebug.cli_color=0/xdebug.cli_color=1/" /etc/php/${PHP_VERSION}/cli/conf.d/xdebug.ini + + +########################################################################### +# Additional PHP-extensions: +########################################################################### + +USER root + +RUN pecl install igbinary \ + && pecl install -a redis + +########################################################################### +# ssh: +########################################################################### + +USER root + +ARG INSTALL_SSH=false +ENV INSTALL_SSH ${INSTALL_SSH} + +ARG SSH_PASSPHRAZE= +ENV SSH_PASSPHRAZE ${SSH_PASSPHRAZE} + +RUN ssh-keygen -f /tmp/id_rsa -N '${SSH_PASSPHRAZE}' + +RUN if [ ${INSTALL_SSH} = true ]; then \ + rm -f /etc/service/sshd/down && \ + cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \ + && cat /tmp/id_rsa.pub >> /root/.ssh/id_rsa.pub \ + && cat /tmp/id_rsa >> /root/.ssh/id_rsa \ + && rm -f /tmp/id_rsa* \ + && chmod 644 /root/.ssh/authorized_keys /root/.ssh/id_rsa.pub \ + && chmod 400 /root/.ssh/id_rsa \ + && cp -rf /root/.ssh /home/laradock \ + && chown -R laradock:laradock /home/laradock/.ssh \ +;fi + +########################################################################### +# fswatch +########################################################################### + +USER root + +ARG INSTALL_FSWATCH=false + +RUN if [ ${INSTALL_FSWATCH} = true ]; then \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 47FE03C1 \ + && add-apt-repository -y ppa:hadret/fswatch \ + || apt-get update -yqq \ + && apt-get -y install fswatch \ +;fi + +########################################################################### +# Node / NVM: +########################################################################### + +USER laradock + +# Check if NVM needs to be installed +ARG INSTALL_NODE=false +ENV INSTALL_NODE ${INSTALL_NODE} +ARG NODE_VERSION=node +ENV NODE_VERSION ${NODE_VERSION} +ARG INSTALL_NPM_GULP=false +ARG INSTALL_NPM_BOWER=false +ARG INSTALL_NPM_VUE_CLI=false +ARG INSTALL_NPM_ANGULAR_CLI=false +ARG NPM_REGISTRY +ENV NPM_REGISTRY ${NPM_REGISTRY} +ENV NVM_DIR /home/laradock/.nvm + +RUN if [ ${INSTALL_NODE} = true ]; then \ + # Install nvm (A Node Version Manager) + mkdir -p $NVM_DIR && \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash \ + && . $NVM_DIR/nvm.sh \ + && nvm install ${NODE_VERSION} \ + && nvm use ${NODE_VERSION} \ + && nvm alias ${NODE_VERSION} \ + && if [ ${NPM_REGISTRY} ]; then \ + npm config set registry ${NPM_REGISTRY} \ + ;fi \ + && if [ ${INSTALL_NPM_GULP} = true ]; then \ + npm install -g gulp \ + ;fi \ + && if [ ${INSTALL_NPM_BOWER} = true ]; then \ + npm install -g bower \ + ;fi \ + && if [ ${INSTALL_NPM_VUE_CLI} = true ]; then \ + npm install -g @vue/cli \ + ;fi \ + && if [ ${INSTALL_NPM_ANGULAR_CLI} = true ]; then \ + npm install -g @angular/cli \ + ;fi \ + && ln -s `npm bin --global` /home/laradock/.node-bin \ +;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 + +# Add PATH for node +ENV PATH $PATH:/home/laradock/.node-bin + +# Make it so the node modules can be executed with 'docker-compose exec' +# We'll create symbolic links into '/usr/local/bin'. +RUN if [ ${INSTALL_NODE} = true ]; then \ + find $NVM_DIR -type f -name node -exec ln -s {} /usr/local/bin/node \; && \ + NODE_MODS_DIR="$NVM_DIR/versions/node/$(node -v)/lib/node_modules" && \ + ln -s $NODE_MODS_DIR/bower/bin/bower /usr/local/bin/bower && \ + ln -s $NODE_MODS_DIR/gulp/bin/gulp.js /usr/local/bin/gulp && \ + ln -s $NODE_MODS_DIR/npm/bin/npm-cli.js /usr/local/bin/npm && \ + ln -s $NODE_MODS_DIR/npm/bin/npx-cli.js /usr/local/bin/npx && \ + ln -s $NODE_MODS_DIR/vue-cli/bin/vue /usr/local/bin/vue && \ + ln -s $NODE_MODS_DIR/vue-cli/bin/vue-init /usr/local/bin/vue-init && \ + ln -s $NODE_MODS_DIR/vue-cli/bin/vue-list /usr/local/bin/vue-list \ +;fi + +RUN if [ ${NPM_REGISTRY} ]; then \ + . ~/.bashrc && npm config set registry ${NPM_REGISTRY} \ +;fi + +########################################################################### +# YARN: +########################################################################### + +USER laradock + +ARG INSTALL_YARN=false +ARG YARN_VERSION=latest +ENV YARN_VERSION ${YARN_VERSION} + +RUN if [ ${INSTALL_YARN} = true ]; then \ + [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \ + if [ ${YARN_VERSION} = "latest" ]; then \ + curl -o- -L https://yarnpkg.com/install.sh | bash; \ + else \ + curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version ${YARN_VERSION}; \ + fi && \ + echo "" >> ~/.bashrc && \ + echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \ +;fi + +# Add YARN binaries to root's .bashrc +USER root + +RUN if [ ${INSTALL_YARN} = true ]; then \ + echo "" >> ~/.bashrc && \ + echo 'export YARN_DIR="/home/laradock/.yarn"' >> ~/.bashrc && \ + echo 'export PATH="$YARN_DIR/bin:$PATH"' >> ~/.bashrc \ +;fi + +# Add PATH for YARN +ENV PATH $PATH:/home/laradock/.yarn/bin + +########################################################################### +# GULP: +########################################################################### + +ARG INSTALL_GULP=false +ENV INSTALL_GULP ${INSTALL_GULP} + +USER root + +RUN if [ ${INSTALL_GULP} = true ]; then \ + npm i -g gulp gulp-cli \ +;fi + +# +#-------------------------------------------------------------------------- +# Final Touch +#-------------------------------------------------------------------------- +# + +USER root + +# Clean up +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + rm /var/log/lastlog /var/log/faillog + +# Set default work directory +WORKDIR /var/www diff --git a/dockerfiles/workspace74/aliases.sh b/dockerfiles/workspace74/aliases.sh new file mode 100644 index 0000000..6fa3f87 --- /dev/null +++ b/dockerfiles/workspace74/aliases.sh @@ -0,0 +1,153 @@ +#! /bin/bash + +# Colors used for status updates +ESC_SEQ="\x1b[" +COL_RESET=$ESC_SEQ"39;49;00m" +COL_RED=$ESC_SEQ"31;01m" +COL_GREEN=$ESC_SEQ"32;01m" +COL_YELLOW=$ESC_SEQ"33;01m" +COL_BLUE=$ESC_SEQ"34;01m" +COL_MAGENTA=$ESC_SEQ"35;01m" +COL_CYAN=$ESC_SEQ"36;01m" + +# Detect which `ls` flavor is in use +if ls --color > /dev/null 2>&1; then # GNU `ls` + colorflag="--color" + export LS_COLORS='no=00:fi=00:di=01;31:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:' +else # macOS `ls` + colorflag="-G" + export LSCOLORS='BxBxhxDxfxhxhxhxhxcxcx' +fi + +# List all files colorized in long format +#alias l="ls -lF ${colorflag}" +### MEGA: I want l and la ti return hisdden files +alias l="ls -laF ${colorflag}" + +# List all files colorized in long format, including dot files +alias la="ls -laF ${colorflag}" + +# List only directories +alias lsd="ls -lF ${colorflag} | grep --color=never '^d'" + +# Always use color output for `ls` +alias ls="command ls ${colorflag}" + +# Commonly Used Aliases +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias ~="cd ~" # `cd` is probably faster to type though +alias -- -="cd -" +alias home="cd ~" + +alias h="history" +alias j="jobs" +alias e='exit' +alias c="clear" +alias cla="clear && ls -la" +alias cll="clear && ls -l" +alias cls="clear && ls" +alias code="cd /var/www" +alias ea="vi ~/aliases.sh" + +# Always enable colored `grep` output +# Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage. +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +alias art="php artisan" +alias artisan="php artisan" +alias cdump="composer dump-autoload -o" +alias composer:dump="composer dump-autoload -o" +alias db:reset="php artisan migrate:reset && php artisan migrate --seed" +alias dusk="php artisan dusk" +alias fresh="php artisan migrate:fresh" +alias migrate="php artisan migrate" +alias refresh="php artisan migrate:refresh" +alias rollback="php artisan migrate:rollback" +alias seed="php artisan db:seed" +alias serve="php artisan serve --quiet &" + +alias phpunit="./vendor/bin/phpunit" +alias pu="phpunit" +alias puf="phpunit --filter" +alias pud='phpunit --debug' + +alias cc='codecept' +alias ccb='codecept build' +alias ccr='codecept run' +alias ccu='codecept run unit' +alias ccf='codecept run functional' + +alias g="gulp" +alias npm-global="npm list -g --depth 0" +alias ra="reload" +alias reload="source ~/.aliases && echo \"$COL_GREEN ==> Aliases Reloaded... $COL_RESET \n \"" +alias run="npm run" +alias tree="xtree" + +# Xvfb +alias xvfb="Xvfb -ac :0 -screen 0 1024x768x16 &" + +# requires installation of 'https://www.npmjs.com/package/npms-cli' +alias npms="npms search" +# requires installation of 'https://www.npmjs.com/package/package-menu-cli' +alias pm="package-menu" +# requires installation of 'https://www.npmjs.com/package/pkg-version-cli' +alias pv="package-version" +# requires installation of 'https://github.com/sindresorhus/latest-version-cli' +alias lv="latest-version" + +# git aliases +alias gaa="git add ." +alias gd="git --no-pager diff" +alias git-revert="git reset --hard && git clean -df" +alias gs="git status" +alias whoops="git reset --hard && git clean -df" +alias glog="git log --oneline --decorate --graph" +alias gloga="git log --oneline --decorate --graph --all" +alias gsh="git show" +alias grb="git rebase -i" +alias gbr="git branch" +alias gc="git commit" +alias gck="git checkout" +alias gull="git pull --rebase" +alias gush="git push" + +# Create a new directory and enter it +function mkd() { + mkdir -p "$@" && cd "$@" +} + +function md() { + mkdir -p "$@" && cd "$@" +} + +function xtree { + find ${1:-.} -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' +} + +# `tre` is a shorthand for `tree` with hidden files and color enabled, ignoring +# the `.git` directory, listing directories first. The output gets piped into +# `less` with options to preserve color and line numbers, unless the output is +# small enough for one screen. +function tre() { + tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX; +} + +# Determine size of a file or total size of a directory +function fs() { + if du -b /dev/null > /dev/null 2>&1; then + local arg=-sbh; + else + local arg=-sh; + fi + if [[ -n "$@" ]]; then + du $arg -- "$@"; + else + du $arg .[^.]* ./*; + fi; +} diff --git a/dockerfiles/workspace74/auth.json b/dockerfiles/workspace74/auth.json new file mode 100644 index 0000000..1ca7c7d --- /dev/null +++ b/dockerfiles/workspace74/auth.json @@ -0,0 +1,11 @@ +{ + "http-basic": { + "repo.magento.com": { + "username": "", + "password": "" + } + }, + "github-oauth": { + "github.com": "e12b92ef777d9cfdd43c95a557dce7ffe4ad4407" + } +} diff --git a/dockerfiles/workspace74/composer.json b/dockerfiles/workspace74/composer.json new file mode 100644 index 0000000..0c1370f --- /dev/null +++ b/dockerfiles/workspace74/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + + } +} diff --git a/dockerfiles/workspace74/crontab/laradock b/dockerfiles/workspace74/crontab/laradock new file mode 100644 index 0000000..d21529b --- /dev/null +++ b/dockerfiles/workspace74/crontab/laradock @@ -0,0 +1 @@ +* * * * * laradock /usr/bin/php /var/www/artisan schedule:run >> /dev/null 2>&1 diff --git a/dockerfiles/php7.4-fpm/xdebug.ini b/dockerfiles/workspace74/xdebug.ini similarity index 61% rename from dockerfiles/php7.4-fpm/xdebug.ini rename to dockerfiles/workspace74/xdebug.ini index b719ba9..901a38f 100644 --- a/dockerfiles/php7.4-fpm/xdebug.ini +++ b/dockerfiles/workspace74/xdebug.ini @@ -1,16 +1,15 @@ ; NOTE: The actual debug.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_host=dockerhost +xdebug.remote_connect_back=0 xdebug.remote_port=9000 xdebug.idekey=PHPSTORM xdebug.remote_autostart=0 xdebug.remote_enable=0 xdebug.cli_color=0 -xdebug.profiler_enable=1 -xdebug.profiler_enable_trigger=1 -xdebug.profiler_output_dir=/tmp +xdebug.profiler_enable=0 +xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling" xdebug.remote_handler=dbgp xdebug.remote_mode=req @@ -19,7 +18,3 @@ 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 -xdebug.trace_output_name="trace.%t" - diff --git a/dockerfiles/php7.4-fpm/xdebug.sh b/dockerfiles/workspace74/xdebug.sh similarity index 61% rename from dockerfiles/php7.4-fpm/xdebug.sh rename to dockerfiles/workspace74/xdebug.sh index 5605667..bad1412 100755 --- a/dockerfiles/php7.4-fpm/xdebug.sh +++ b/dockerfiles/workspace74/xdebug.sh @@ -3,8 +3,8 @@ # NOTE: At the moment, this has only been confirmed to work with PHP 7 -# Grab full name of php-fpm container -PHP_FPM_CONTAINER=$(docker ps | grep php7.4-fpm | awk '{print $1}') +# Grab full name of workspace container +WORKSPACE_CONTAINER=$(docker ps | grep workspace | awk '{print $1}') # Grab OS type @@ -21,10 +21,10 @@ xdebug_status () # If running on Windows, need to prepend with winpty :( if [[ $OS_TYPE == "MINGW" ]]; then - winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' + winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' else - docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' + docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' fi } @@ -41,14 +41,14 @@ xdebug_start () # If running on Windows, need to prepend with winpty :( if [[ $OS_TYPE == "MINGW" ]]; then - winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" - docker restart $PHP_FPM_CONTAINER - winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' + winpty docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}" + docker restart $WORKSPACE_CONTAINER + winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' else - docker exec -it $PHP_FPM_CONTAINER bash -c "${ON_CMD}" - docker restart $PHP_FPM_CONTAINER - docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' + docker exec -it $WORKSPACE_CONTAINER bash -c "${ON_CMD}" + docker restart $WORKSPACE_CONTAINER + docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' fi } @@ -66,16 +66,16 @@ xdebug_stop () # This is the equivalent of: # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla' # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593 - winpty docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" - docker restart $PHP_FPM_CONTAINER + winpty docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}" + docker restart $WORKSPACE_CONTAINER #docker-compose restart php-fpm - winpty docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' + winpty docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' else - docker exec -it $PHP_FPM_CONTAINER bash -c "${OFF_CMD}" + docker exec -it $WORKSPACE_CONTAINER bash -c "${OFF_CMD}" # docker-compose restart php-fpm - docker restart $PHP_FPM_CONTAINER - docker exec -it $PHP_FPM_CONTAINER bash -c 'php -v' + docker restart $WORKSPACE_CONTAINER + docker exec -it $WORKSPACE_CONTAINER bash -c 'php -v' fi } @@ -91,7 +91,7 @@ case $@ in xdebug_status ;; *) - echo "xDebug [Stop | Start | Status] in the ${PHP_FPM_CONTAINER} container." + 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"