Browse Source

Initial commit

master
Alexander Demidov 2 years ago
commit
4b434f2268
  1. 38
      .env.example
  2. 4
      .gitignore
  3. 1
      config/nginx/conf.d/.gitignore
  4. 55
      config/nginx/conf.d/vhost.conf.example
  5. 47
      config/nginx/includes.d/octobercms.conf
  6. 21
      config/nginx/includes.d/staticfiles.conf
  7. 1319
      config/redis/redis.conf
  8. 2
      config/sphinx/.gitignore
  9. 2
      data/.gitignore
  10. 176
      docker-compose.yml.example
  11. 126
      dockerfiles/php-fpm/Dockerfile
  12. 25
      dockerfiles/php-fpm/xdebug.ini
  13. 101
      dockerfiles/php-fpm/xdebug.sh
  14. 126
      dockerfiles/php7.1-fpm/Dockerfile
  15. 25
      dockerfiles/php7.1-fpm/xdebug.ini
  16. 101
      dockerfiles/php7.1-fpm/xdebug.sh
  17. 4
      dockerfiles/sphinx/Dockerfile
  18. 2
      dockerfiles/sphinx/searchd.sh
  19. 443
      dockerfiles/workspace/Dockerfile
  20. 3
      dockerfiles/workspace/aerospike.ini
  21. 153
      dockerfiles/workspace/aliases.sh
  22. 11
      dockerfiles/workspace/auth.json
  23. 5
      dockerfiles/workspace/composer.json
  24. 1
      dockerfiles/workspace/crontab/laradock
  25. 20
      dockerfiles/workspace/xdebug.ini
  26. 6
      dockerfiles/wp-cli/Dockerfile
  27. 3
      hooks/enter-to-workspace.sh
  28. 3
      hooks/mysql.sh
  29. 2
      hooks/quit-xdebug.sh
  30. 3
      hooks/restart-nginx.sh
  31. 2
      hooks/start-xdebug.sh
  32. 2
      hostfiles/.gitignore
  33. 2
      log/.gitignore

38
.env.example

@ -0,0 +1,38 @@
# Enter your Docker Host IP (will be appended to /etc/hosts). Default is `10.0.75.1`
DOCKER_HOST_IP=172.20.0.1
PROJECTS_DIR=/home/youruser/PhpstormProjects
### WORKSPACE #############################################
WORKSPACE_PHP_VERSION=7.3
WORKSPACE_PUID=1000
WORKSPACE_PGID=1000
WORKSPACE_TIMEZONE=Europe/Moscow
WORKSPACE_COMPOSER_GLOBAL_INSTALL=true
WORKSPACE_COMPOSER_AUTH=false
WORKSPACE_COMPOSER_REPO_PACKAGIST=
WORKSPACE_INSTALL_WP_CLI=true
WORKSPACE_INSTALL_XDEBUG=false
WORKSPACE_INSTALL_SSH=true
WORKSPACE_SSH_PASSPHRAZE=RSfndC66KmuRPRtSXOEe
WORKSPACE_INSTALL_FSWATCH=false
WORKSPACE_INSTALL_NODE=true
WORKSPACE_NODE_VERSION=lts/carbon
WORKSPACE_NPM_REGISTRY=
WORKSPACE_INSTALL_YARN=true
WORKSPACE_YARN_VERSION=latest
WORKSPACE_INSTALL_GULP=true
WORKSPACE_INSTALL_MYSQL_CLIENT=true
WORKSPACE_INSTALL_PING=true
WORKSPACE_INSTALL_PYTHON=true
### PHP-FPM #############################################
INSTALL_XDEBUG=true
INSTALL_REDIS=true
INSTALL_PEAR_MAIL=true
INSTALL_ZIP=true
INSTALL_BZ2=true
INSTALL_INTL=true
PHP_OPT_SHORT_OPEN_TAG=On
PHP_OPT_MAX_EXECUTION_TIME=600
PHP_OPT_MEMORY_LIMIT=500M
PHP_OPT_UPLOAD_MAX_FILESIZE=20M

4
.gitignore

@ -0,0 +1,4 @@
/.idea
/dockerfiles/ypt-encoder
/docker-compose.yml
/.env

1
config/nginx/conf.d/.gitignore

@ -0,0 +1 @@
*.conf

55
config/nginx/conf.d/vhost.conf.example

@ -0,0 +1,55 @@
upstream fpm {
server php-fpm:9000;
}
upstream fpm7.1 {
server php7.1-fpm:9000;
}
map $http_host $root {
loc.octobercms /usr/share/nginx/html/someproject;
loc.wordpress /usr/share/nginx/html/someprojectwp;
}
server {
server_name loc.octobercms;
listen 80;
root $root;
#include global/auth.conf;
#@see https://vcs.wpstudio.ru/wpstudio/nginx-examples
include includes.d/octobercms.conf;
include includes.d/staticfiles.conf;
location ~ ^/index.php {
fastcgi_pass fpm;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
server {
server_name loc.wordpress;
listen 80;
root $root;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_pass fpm;
fastcgi_index index.php;
}
}

47
config/nginx/includes.d/octobercms.conf

@ -0,0 +1,47 @@
location / {
rewrite ^/.*$ /index.php last;
}
location ~ ^/combine.*\.(css|js) {
rewrite ^/.*$ /index.php last;
expires max;
}
# Whitelist
## Let October handle if static file not exists
location ~ ^/favicon\.ico { try_files $uri /index.php; }
location ~ ^/sitemap\.xml { try_files $uri /index.php; }
location ~ ^/robots\.txt { try_files $uri /index.php; }
location ~ ^/humans\.txt { try_files $uri /index.php; }
## Let nginx return 404 if static file not exists
location ~ ^/storage/app/uploads/public { try_files $uri /404; }
location ~ ^/storage/app/media { try_files $uri /404; }
location ~ ^/files { try_files $uri /404; }
location ~ ^/storage/app/.*\.xls { try_files $uri /404; }
location ~ ^/storage/temp/public { try_files $uri /404; }
location ~ ^/modules/.*/assets { try_files $uri /404; }
location ~ ^/modules/.*/resources { try_files $uri /404; }
location ~ ^/modules/.*/behaviors/.*/assets { try_files $uri /404; }
location ~ ^/modules/.*/behaviors/.*/resources { try_files $uri /404; }
location ~ ^/modules/.*/widgets/.*/assets { try_files $uri /404; }
location ~ ^/modules/.*/widgets/.*/resources { try_files $uri /404; }
location ~ ^/modules/.*/formwidgets/.*/assets { try_files $uri /404; }
location ~ ^/modules/.*/formwidgets/.*/resources { try_files $uri /404; }
location ~ ^/modules/.*/reportwidgets/.*/assets { try_files $uri /404; }
location ~ ^/modules/.*/reportwidgets/.*/resources { try_files $uri /404; }
location ~ ^/plugins/.*/.*/assets { try_files $uri /404; }
location ~ ^/plugins/.*/.*/resources { try_files $uri /404; }
location ~ ^/plugins/.*/.*/behaviors/.*/assets { try_files $uri /404; }
location ~ ^/plugins/.*/.*/behaviors/.*/resources { try_files $uri /404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/assets { try_files $uri /404; }
location ~ ^/plugins/.*/.*/reportwidgets/.*/resources { try_files $uri /404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/assets { try_files $uri /404; }
location ~ ^/plugins/.*/.*/formwidgets/.*/resources { try_files $uri /404; }
location ~ ^/plugins/.*/.*/widgets/.*/assets { try_files $uri /404; }
location ~ ^/plugins/.*/.*/widgets/.*/resources { try_files $uri /404; }
location ~ ^/themes/.*/assets { try_files $uri /404; }
location ~ ^/themes/.*/semantic { try_files $uri /404; }
location ~ ^/themes/.*/resources { try_files $uri /404; }

21
config/nginx/includes.d/staticfiles.conf

@ -0,0 +1,21 @@
rewrite "^(.*)\.(\d{10})\.(css|js)$" $1.$3 break;
location ~* \.(jpg|jpeg|gif|png|svg|ico)$ {
access_log off;
expires max;
log_not_found off;
error_page 404 = /empty;
}
location = /empty {
expires 0;
empty_gif;
}
location ~* \.(eot|ttf|woff|pdf|css|js)$ {
access_log off;
expires max;
}
location ~ /\. {
deny all;
}
location ~* \.(tpl|ini|sh) {
deny all;
}

1319
config/redis/redis.conf
File diff suppressed because it is too large
View File

2
config/sphinx/.gitignore

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

2
data/.gitignore

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

176
docker-compose.yml.example

@ -0,0 +1,176 @@
version: "2"
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:
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:
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:
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}"
workspace_alex2911:
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}"
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"
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- database:/var/lib/mysql
- ./hostfiles:/hostfiles
ports:
- "3306:3306"
phpmyadmin:
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
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:

126
dockerfiles/php-fpm/Dockerfile

@ -0,0 +1,126 @@
FROM php:7.3-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-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"

25
dockerfiles/php-fpm/xdebug.ini

@ -0,0 +1,25 @@
; 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"

101
dockerfiles/php-fpm/xdebug.sh

@ -0,0 +1,101 @@
#! /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 php-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

126
dockerfiles/php7.1-fpm/Dockerfile

@ -0,0 +1,126 @@
FROM php:7.1-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-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"

25
dockerfiles/php7.1-fpm/xdebug.ini

@ -0,0 +1,25 @@
; 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"

101
dockerfiles/php7.1-fpm/xdebug.sh

@ -0,0 +1,101 @@
#! /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 php-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

4
dockerfiles/sphinx/Dockerfile

@ -0,0 +1,4 @@
FROM stefobark/sphinxdocker
ADD searchd.sh /
RUN chmod a+x searchd.sh

2
dockerfiles/sphinx/searchd.sh

@ -0,0 +1,2 @@
#!/bin/bash
searchd -c /etc/sphinxsearch/sphinx.conf --nodetach "$@"

443
dockerfiles/workspace/Dockerfile

@ -0,0 +1,443 @@
#
#--------------------------------------------------------------------------
# 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="Mahmoud Zalt <mahmoud@zalt.me>"
# 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
###########################################################################
# 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
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
###########################################################################
# 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:
###########################################################################
RUN pecl install igbinary \
&& pecl install -a redis
###########################################################################
# ssh:
###########################################################################
ARG INSTALL_SSH=false
ENV INSTALL_SSH ${INSTALL_SSH}
ARG SSH_PASSPHRAZE=12345
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
###########################################################################
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:
###########################################################################
# 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 \
echo "" >> ~/.bashrc && \
echo 'export NVM_DIR="/home/laradock/.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
###########################################################################
# YARN:
###########################################################################
ARG INSTALL_GULP=false
ENV INSTALL_GULP ${INSTALL_GULP}
USER root
RUN if [ ${INSTALL_GULP} = true ]; then \
npm i -g gulp gulp-cli \
;fi
###########################################################################
# 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 \
&& python -m pip install --upgrade virtualenv \
;fi
###########################################################################
# Check PHP version:
###########################################################################
RUN set -xe; php -v | head -n 1 | grep -q "PHP ${PHP_VERSION}."
#
#--------------------------------------------------------------------------
# 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

3
dockerfiles/workspace/aerospike.ini

@ -0,0 +1,3 @@
extension=aerospike.so
aerospike.udf.lua_system_path=/usr/local/aerospike/lua
aerospike.udf.lua_user_path=/usr/local/aerospike/usr-lua

153
dockerfiles/workspace/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;
}

11
dockerfiles/workspace/auth.json

@ -0,0 +1,11 @@
{
"http-basic": {
"repo.magento.com": {
"username": "",
"password": ""
}
},
"github-oauth": {
"github.com": "e12b92ef777d9cfdd43c95a557dce7ffe4ad4407"
}
}

5
dockerfiles/workspace/composer.json

@ -0,0 +1,5 @@
{
"require": {
}
}

1
dockerfiles/workspace/crontab/laradock

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

20
dockerfiles/workspace/xdebug.ini

@ -0,0 +1,20 @@
; 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=0
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"
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

6
dockerfiles/wp-cli/Dockerfile

@ -0,0 +1,6 @@
FROM michaloo/wp-cli
# And adds dockerpresso plugins:
# RUN wp package install michaloo/wp-cli-environmentalize
CMD ["/sbin/my_init"]

3
hooks/enter-to-workspace.sh

@ -0,0 +1,3 @@
#!/bin/bash
cd $HOME/docker-compose-projects/structure
docker-compose exec workspace su laradock

3
hooks/mysql.sh

@ -0,0 +1,3 @@
#!/bin/bash
cd $HOME/docker-compose-projects/structure
docker-compose exec db mysql -u root -p123456

2
hooks/quit-xdebug.sh

@ -0,0 +1,2 @@
#!/bin/bash
cd docker-compose-projects/structure/ && ./dockerfiles/php-fpm/xdebug.sh stop && cd

3
hooks/restart-nginx.sh

@ -0,0 +1,3 @@
#!/bin/bash
cd $HOME/docker-compose-projects/structure
docker-compose exec web nginx -s reload

2
hooks/start-xdebug.sh

@ -0,0 +1,2 @@
#!/bin/bash
cd docker-compose-projects/structure/ && ./dockerfiles/php-fpm/xdebug.sh start && cd

2
hostfiles/.gitignore

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

2
log/.gitignore

@ -0,0 +1,2 @@
*
!.gitignore
Loading…
Cancel
Save