├── .gitignore ├── LICENSE ├── README.md ├── application └── Dockerfile ├── cpoComposerUpdate.cmd ├── data └── Dockerfile ├── dc.cmd ├── docker-compose.yml ├── laravelComposerUpdate.cmd ├── mariadb └── Dockerfile ├── nginx ├── Dockerfile ├── default.conf ├── nginx.conf └── sites │ ├── cpo.conf │ ├── home.conf │ └── laravel.conf ├── php-fpm ├── Dockerfile ├── Dockerfile-55 ├── Dockerfile-56 ├── Dockerfile-70 ├── Dockerfile-70-original ├── README.md ├── docker-entrypoint.sh ├── laravel.ini ├── laravel.pool.conf └── xdebug.ini └── workspace └── Dockerfile /.gitignore: -------------------------------------------------------------------------------- 1 | /logs 2 | .env 3 | .idea 4 | **/id_rsa* 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PhpDock 2 | 3 | [Inspired by Laradock](https://github.com/LaraDock/laradock) 4 | 5 | ## Installation 6 | - Install `Laravel` 7 | - Clone this repo into sibling directory 8 | - Create ssh keys 9 | - `php-fpm/id_rsa_vm` 10 | - `php-fpm/id_rsa_vm.pub` 11 | - `/C/Users/larry/.ssh/id_rsa_vm.ppk` (puttygen'd) Used in PHPStorm for keyless connection 12 | - `cd phpdock` 13 | - docker-compose -d up nginx mariadb 14 | - Visit: `http://laravel/` 15 | 16 | Start ssh in container 17 | `docker-compose exec -d php-fpm service ssh start` 18 | 19 | 20 | ##Settings 21 | ### Deployment 22 | - Name: `laravel` 23 | - Connection: 24 | - Type: `SFTP` 25 | - SFTP host: `laravel` (set domain in hosts to point to docker IP) 26 | - Port: 22 27 | - Root path: `/var/www/laravel` 28 | - User name: `root` 29 | - Auth type: `Key pair (OpenSSH or PuTTY)` 30 | - Private key file: `C:\Users\larry\id_rsa_vm.ppk` (created a puttygen ppk) 31 | - Web server root URL: `http://laravel` 32 | - Mappings 33 | - Local Path: `C:\_dk\laravel` Deployment: `\` 34 | - Local Path: `C:\_dk\laravel\public` Deployment: `\` 35 | 36 | ### Languages & Frameworks / PHP 37 | - Developement environment 38 | - PHP language level `7` 39 | - Interpreter: `laravel (7.0.7)` 40 | - Interpreters 41 | - Name: `laravel` 42 | - Remote 43 | - Remote: `Deployment configuration` 44 | - Deployment configuration: `sftp laravel` 45 | - Deployment Host URL: ssh://root@laravel:22 46 | - General 47 | - PHP executable: `/usr/local/bin/php` 48 | - (i) PHP version: `7.0.7` Debugger: `Xdebug 2.4.2` 49 | - (i) Configuration file: `/usr/local/etc/php/php.ini` 50 | - Path mappings 51 | - From deployment configuration 52 | - Local Path: `C:/_dk/laravel` Deployment: `/var/www/laravel` 53 | - Local Path: `C:/_dk/laravel/public` Deployment: `/var/www/laravel/public` 54 | 55 | ### Languages & Frameworks / PHP / Debug 56 | - Xdebug 57 | - Debug port: `9000` [`x`] Can accept external connections 58 | 59 | ### Languages & Frameworks / PHP / Servers 60 | - Name: `laravel` 61 | - Host: `laravel` : Port `80` Debugger `Xdebug` 62 | [`x`] Use path mappings 63 | - File/Directory: `C:\_dk\laravel` Absolute: `/var/www/laravel` 64 | - File/Directory: `C:\_dk\laravel\tests` Absolute: `/var/www/laravel/tests` 65 | 66 | ### Languages & Frameworks / PHP / PHPUnit 67 | - Interpreter: `laravel` 68 | - Path mappings: 69 | - Local Path: `C:/_dk/laravel` Deployment: `/var/www/laravel` 70 | - Local Path: `C:/_dk/laravel/public` Deployment: `/var/www/laravel/public` 71 | - PHPUnit library 72 | - [`x`]Use Composer autoloader 73 | - Path to script: `/var/www/laravel/vendor/autoload.php` 74 | - Test Runner 75 | - [`x`] Default configuration file: `/var/www/laravel/phpunit.xml` 76 | 77 | ## Run Debug/Debug Configurations 78 | - PHPUnit: 79 | - Name: `ExampleTest` 80 | - [`x`] Class 81 | - Class: `ExampleTest` 82 | - File: `C:\_dk\laravel\tests\ExampleTest.php` 83 | - Test Runner options: `--colors --tap --verbose --debug` (Probably unnecessary ) 84 | 85 | # Run Test with Debugging 86 | - Open: `C:\_dk\laravel\tests\ExampleTest.php` 87 | - Set breakpoint on line: `$this->visit('/')` 88 | - Press: `Shift-F9` 89 | - SHOULD be stopped on breakpoint! 90 | 91 | ## License 92 | 93 | [MIT License](https://github.com/larryeitel/phpdock/blob/master/LICENSE) (MIT) 94 | -------------------------------------------------------------------------------- /application/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | WORKDIR /var/www/laravel 6 | 7 | CMD ["true"] 8 | -------------------------------------------------------------------------------- /cpoComposerUpdate.cmd: -------------------------------------------------------------------------------- 1 | docker exec pd_workspace_1 /bin/bash cd /var/www/cpo; composer update -------------------------------------------------------------------------------- /data/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | CMD ["true"] 6 | -------------------------------------------------------------------------------- /dc.cmd: -------------------------------------------------------------------------------- 1 | docker-compose up -d nginx mariadb 2 | 3 | :: https://github.com/docker/compose/issues/1809 4 | docker exec pd_mariadb_1 /bin/bash /entrypoint-initdb.d/init_db.sh 5 | 6 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | 5 | ### PHP-FPM Container ####################################### 6 | 7 | php-fpm: 8 | build: 9 | context: ./php-fpm 10 | dockerfile: Dockerfile-70 11 | volumes_from: 12 | - application 13 | expose: 14 | - "9000" 15 | links: 16 | - workspace 17 | ports: 18 | - "22:22" 19 | - "9000:9000" 20 | environment: 21 | # PHPRC: "/usr/src/php/php.ini-development" 22 | PHP_IDE_CONFIG: "serverName=dk" 23 | tty: true 24 | 25 | ### Laravel Application Code Container ###################### 26 | 27 | application: 28 | build: ./application 29 | volumes: 30 | - ../laravel:/var/www/laravel 31 | - ../cpo:/var/www/cpo 32 | - ../home:/var/www/home 33 | 34 | ### Databases Data Container ################################ 35 | 36 | data: 37 | build: ./data 38 | volumes: 39 | - /var/lib/mariadb:/var/lib/mariadb 40 | 41 | ### Nginx Server Container ################################## 42 | 43 | nginx: 44 | build: ./nginx 45 | volumes_from: 46 | - application 47 | volumes: 48 | - ./logs/nginx/:/var/log/nginx 49 | ports: 50 | - "80:80" 51 | - "443:443" 52 | links: 53 | - php-fpm 54 | 55 | ### MariaDB Container ####################################### 56 | 57 | mariadb: 58 | build: ./mariadb 59 | volumes_from: 60 | - data 61 | ports: 62 | - "3306:3306" 63 | environment: 64 | MYSQL_DATABASE: homestead 65 | MYSQL_USER: homestead 66 | MYSQL_PASSWORD: secret 67 | MYSQL_ROOT_PASSWORD: root 68 | 69 | ### Workspace Utilities Container ########################### 70 | 71 | workspace: 72 | build: 73 | context: ./workspace 74 | args: 75 | # INSTALL_PRESTISSIMO: ${INSTALL_PRESTISSIMO} 76 | INSTALL_PRESTISSIMO: 1 77 | volumes_from: 78 | - application 79 | tty: true 80 | -------------------------------------------------------------------------------- /laravelComposerUpdate.cmd: -------------------------------------------------------------------------------- 1 | docker exec pd_workspace_1 /bin/bash cd /var/www/laravel; composer update -------------------------------------------------------------------------------- /mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mariadb:latest 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | CMD ["mysqld"] 6 | 7 | EXPOSE 3306 8 | -------------------------------------------------------------------------------- /nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:latest 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | # ADD default.conf /etc/nginx/conf.d 6 | ADD nginx.conf /etc/nginx/ 7 | COPY sites/* /etc/nginx/sites-available/ 8 | 9 | RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf 10 | 11 | RUN usermod -u 1000 www-data 12 | 13 | CMD ["nginx"] 14 | 15 | EXPOSE 80 443 16 | -------------------------------------------------------------------------------- /nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name pd; 4 | 5 | root /var/www/laravel/public; 6 | 7 | #charset koi8-r; 8 | #access_log /var/log/nginx/log/host.access.log main; 9 | 10 | location / { 11 | try_files $uri $uri/ /index.php$is_args$args; 12 | } 13 | 14 | location ~ \.php$ { 15 | try_files $uri /index.php =404; 16 | fastcgi_pass php-upstream; 17 | fastcgi_index index.php; 18 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 19 | include fastcgi_params; 20 | } 21 | 22 | location ~ /\.ht { 23 | deny all; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | user www-data; 2 | worker_processes 4; 3 | pid /run/nginx.pid; 4 | 5 | events { 6 | worker_connections 2048; 7 | multi_accept on; 8 | use epoll; 9 | } 10 | 11 | http { 12 | server_tokens off; 13 | sendfile on; 14 | tcp_nopush on; 15 | tcp_nodelay on; 16 | keepalive_timeout 15; 17 | types_hash_max_size 2048; 18 | client_max_body_size 20M; 19 | include /etc/nginx/mime.types; 20 | default_type application/octet-stream; 21 | access_log on; 22 | error_log on; 23 | gzip on; 24 | gzip_disable "msie6"; 25 | include /etc/nginx/conf.d/*.conf; 26 | include /etc/nginx/sites-available/*; 27 | open_file_cache max=100; 28 | } 29 | 30 | daemon off; 31 | -------------------------------------------------------------------------------- /nginx/sites/cpo.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | server_name cpo.dk; 5 | 6 | root /var/www/cpo/public; 7 | 8 | index index.php index.html index.htm; 9 | 10 | location / { 11 | try_files $uri $uri/ /index.php$is_args$args; 12 | } 13 | 14 | location ~ \.php$ { 15 | try_files $uri /index.php =404; 16 | fastcgi_pass php-upstream; 17 | fastcgi_index index.php; 18 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 19 | include fastcgi_params; 20 | } 21 | 22 | location ~ /\.ht { 23 | deny all; 24 | } 25 | } 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /nginx/sites/home.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name home; 4 | 5 | root /var/www/home/public; 6 | index index.php index.html index.htm; 7 | 8 | location / { 9 | try_files $uri $uri/ /index.php$is_args$args; 10 | } 11 | 12 | location ~ \.php$ { 13 | try_files $uri /index.php =404; 14 | fastcgi_pass php-upstream; 15 | fastcgi_index index.php; 16 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 17 | include fastcgi_params; 18 | } 19 | 20 | location ~ /\.ht { 21 | deny all; 22 | } 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /nginx/sites/laravel.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name laravel; 4 | 5 | root /var/www/laravel/public; 6 | index index.php index.html index.htm; 7 | 8 | location / { 9 | try_files $uri $uri/ /index.php$is_args$args; 10 | } 11 | 12 | location ~ \.php$ { 13 | try_files $uri /index.php =404; 14 | fastcgi_pass php-upstream; 15 | fastcgi_index index.php; 16 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 17 | include fastcgi_params; 18 | } 19 | 20 | location ~ /\.ht { 21 | deny all; 22 | } 23 | } 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /php-fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.0-fpm 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | ADD ./laravel.ini /usr/local/etc/php/conf.d 6 | ADD ./xdebug.ini /usr/local/etc/php/conf.d 7 | ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ 8 | 9 | RUN apt-get update && apt-get install -y \ 10 | libpq-dev \ 11 | libmemcached-dev \ 12 | php-pear \ 13 | libpng12-dev \ 14 | libfreetype6-dev \ 15 | ssh \ 16 | telnet \ 17 | git \ 18 | curl \ 19 | less \ 20 | vim \ 21 | nano \ 22 | --no-install-recommends \ 23 | && rm -r /var/lib/apt/lists/* 24 | 25 | # configure gd library 26 | RUN docker-php-ext-configure gd \ 27 | --enable-gd-native-ttf \ 28 | --with-freetype-dir=/usr/include/freetype2 29 | 30 | # Install extensions using the helper script provided by the base image 31 | RUN docker-php-ext-install \ 32 | pdo_mysql \ 33 | gd 34 | 35 | # Install Memcached for php 7 36 | RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ 37 | && mkdir -p /usr/src/php/ext/memcached \ 38 | && tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ 39 | && docker-php-ext-configure memcached \ 40 | && docker-php-ext-install memcached \ 41 | && rm /tmp/memcached.tar.gz 42 | 43 | 44 | # Install xdebug 45 | RUN pecl install xdebug \ 46 | && docker-php-ext-enable xdebug 47 | 48 | 49 | # Install mongodb driver 50 | # RUN pecl install mongodb 51 | 52 | 53 | RUN rm -f /etc/service/sshd/down 54 | 55 | ## Created keys for vm use 56 | RUN mkdir -p /root/.ssh 57 | ADD ./id_rsa_vm /root/.ssh 58 | ADD ./id_rsa_vm.pub /root/.ssh 59 | RUN ls /root/.ssh 60 | RUN touch /root/.ssh/authorized_keys 61 | RUN cat /root/.ssh/id_rsa_vm.pub >> /root/.ssh/authorized_keys 62 | 63 | RUN usermod -u 1000 www-data 64 | 65 | # WORKDIR /var/www/laravel 66 | WORKDIR /var/www/cpo 67 | 68 | CMD ["php-fpm"] 69 | # CMD ["ssh"] 70 | 71 | EXPOSE 9000 72 | -------------------------------------------------------------------------------- /php-fpm/Dockerfile-55: -------------------------------------------------------------------------------- 1 | FROM php:5.5-fpm 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | ADD ./laravel.ini /usr/local/etc/php/conf.d 6 | ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ 7 | 8 | RUN apt-get update && apt-get install -y \ 9 | libpq-dev \ 10 | libmemcached-dev \ 11 | curl \ 12 | libpng12-dev \ 13 | libfreetype6-dev \ 14 | libssl-dev \ 15 | libmcrypt-dev \ 16 | --no-install-recommends \ 17 | && rm -r /var/lib/apt/lists/* 18 | 19 | # install mcrypt library 20 | RUN docker-php-ext-install mcrypt 21 | 22 | # Install mongodb driver 23 | RUN pecl install mongodb 24 | 25 | # configure gd library 26 | RUN docker-php-ext-configure gd \ 27 | --enable-gd-native-ttf \ 28 | --with-freetype-dir=/usr/include/freetype2 29 | 30 | # Install extensions using the helper script provided by the base image 31 | RUN docker-php-ext-install \ 32 | pdo_mysql \ 33 | pdo_pgsql \ 34 | gd 35 | 36 | # Install memcached 37 | RUN pecl install memcached \ 38 | && docker-php-ext-enable memcached 39 | 40 | # Install xdebug 41 | RUN pecl install xdebug \ 42 | && docker-php-ext-enable xdebug 43 | 44 | RUN usermod -u 1000 www-data 45 | 46 | WORKDIR /var/www/laravel 47 | 48 | CMD ["php-fpm"] 49 | 50 | EXPOSE 9000 51 | -------------------------------------------------------------------------------- /php-fpm/Dockerfile-56: -------------------------------------------------------------------------------- 1 | FROM php:5.6-fpm 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | ADD ./laravel.ini /usr/local/etc/php/conf.d 6 | ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ 7 | 8 | RUN apt-get update && apt-get install -y \ 9 | libpq-dev \ 10 | libmemcached-dev \ 11 | curl \ 12 | libpng12-dev \ 13 | libfreetype6-dev \ 14 | libssl-dev \ 15 | libmcrypt-dev \ 16 | --no-install-recommends \ 17 | && rm -r /var/lib/apt/lists/* 18 | 19 | # install mcrypt library 20 | RUN docker-php-ext-install mcrypt 21 | 22 | # Install mongodb driver 23 | RUN pecl install mongodb 24 | 25 | # configure gd library 26 | RUN docker-php-ext-configure gd \ 27 | --enable-gd-native-ttf \ 28 | --with-freetype-dir=/usr/include/freetype2 29 | 30 | # Install extensions using the helper script provided by the base image 31 | RUN docker-php-ext-install \ 32 | pdo_mysql \ 33 | pdo_pgsql \ 34 | gd 35 | 36 | # Install memcached 37 | RUN pecl install memcached \ 38 | && docker-php-ext-enable memcached 39 | 40 | # Install xdebug 41 | RUN pecl install xdebug \ 42 | && docker-php-ext-enable xdebug 43 | 44 | RUN usermod -u 1000 www-data 45 | 46 | WORKDIR /var/www/laravel 47 | 48 | CMD ["php-fpm"] 49 | 50 | EXPOSE 9000 51 | -------------------------------------------------------------------------------- /php-fpm/Dockerfile-70: -------------------------------------------------------------------------------- 1 | FROM php:7.0-fpm 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | ADD ./laravel.ini /usr/local/etc/php/conf.d 6 | ADD ./xdebug.ini /usr/local/etc/php/conf.d 7 | ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ 8 | 9 | RUN apt-get update && apt-get install -y \ 10 | libpq-dev \ 11 | curl \ 12 | libpng12-dev \ 13 | libfreetype6-dev \ 14 | libssl-dev \ 15 | libmcrypt-dev \ 16 | php-pear \ 17 | ssh \ 18 | telnet \ 19 | git \ 20 | curl \ 21 | less \ 22 | vim \ 23 | nano \ 24 | --no-install-recommends \ 25 | && rm -r /var/lib/apt/lists/* 26 | 27 | 28 | # install mcrypt library 29 | RUN docker-php-ext-install mcrypt 30 | 31 | # configure gd library 32 | RUN docker-php-ext-configure gd \ 33 | --enable-gd-native-ttf \ 34 | --with-freetype-dir=/usr/include/freetype2 35 | 36 | # Install extensions using the helper script provided by the base image 37 | RUN docker-php-ext-install \ 38 | pdo_mysql \ 39 | gd 40 | 41 | # Install Memcached for php 7 42 | # RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ 43 | # && mkdir -p /usr/src/php/ext/memcached \ 44 | # && tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ 45 | # && docker-php-ext-configure memcached \ 46 | # && docker-php-ext-install memcached \ 47 | # && rm /tmp/memcached.tar.gz 48 | 49 | RUN cd /usr/share \ 50 | && git clone https://github.com/pear/pear-core.git pear 51 | 52 | # Install xdebug 53 | RUN pecl install xdebug \ 54 | && docker-php-ext-enable xdebug 55 | 56 | # Add bin folder of composer to PATH. 57 | # RUN echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc 58 | 59 | # Install Composer 60 | # RUN curl -s http://getcomposer.org/installer | php \ 61 | # && mv composer.phar /usr/local/bin/composer 62 | 63 | # Load xdebug Zend extension with phpunit command 64 | # RUN echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc 65 | 66 | 67 | RUN cp /usr/src/php/php.ini-development /usr/local/etc/php/php.ini 68 | RUN cp /usr/src/php/php.ini-development /usr/src/php/php.ini 69 | 70 | RUN rm -f /etc/service/sshd/down 71 | 72 | ## Created keys for vm use 73 | RUN mkdir -p /root/.ssh 74 | 75 | # These are excluded in .gitignore 76 | ADD ./id_rsa_vm /root/.ssh 77 | ADD ./id_rsa_vm.pub /root/.ssh 78 | 79 | RUN ls /root/.ssh 80 | RUN touch /root/.ssh/authorized_keys 81 | RUN cat /root/.ssh/id_rsa_vm.pub >> /root/.ssh/authorized_keys 82 | 83 | RUN usermod -u 1000 www-data 84 | 85 | WORKDIR /var/www/laravel 86 | 87 | CMD ["php-fpm"] 88 | 89 | EXPOSE 9000 90 | -------------------------------------------------------------------------------- /php-fpm/Dockerfile-70-original: -------------------------------------------------------------------------------- 1 | FROM php:7.0-fpm 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | ADD ./laravel.ini /usr/local/etc/php/conf.d 6 | ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ 7 | 8 | RUN apt-get update && apt-get install -y \ 9 | libpq-dev \ 10 | libmemcached-dev \ 11 | curl \ 12 | libpng12-dev \ 13 | libfreetype6-dev \ 14 | --no-install-recommends \ 15 | && rm -r /var/lib/apt/lists/* 16 | 17 | # configure gd library 18 | RUN docker-php-ext-configure gd \ 19 | --enable-gd-native-ttf \ 20 | --with-freetype-dir=/usr/include/freetype2 21 | 22 | # Install extensions using the helper script provided by the base image 23 | RUN docker-php-ext-install \ 24 | pdo_mysql \ 25 | pdo_pgsql \ 26 | gd 27 | 28 | # Install Memcached for php 7 29 | RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ 30 | && mkdir -p /usr/src/php/ext/memcached \ 31 | && tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ 32 | && docker-php-ext-configure memcached \ 33 | && docker-php-ext-install memcached \ 34 | && rm /tmp/memcached.tar.gz 35 | 36 | # Install xdebug 37 | RUN pecl install xdebug \ 38 | && docker-php-ext-enable xdebug 39 | 40 | # Install mongodb driver 41 | RUN pecl install mongodb 42 | 43 | RUN usermod -u 1000 www-data 44 | 45 | WORKDIR /var/www/laravel 46 | 47 | CMD ["php-fpm"] 48 | 49 | EXPOSE 9000 50 | -------------------------------------------------------------------------------- /php-fpm/README.md: -------------------------------------------------------------------------------- 1 | # Warning while building php-fpm 2 | 3 | configuration option "php_ini" is not set to php.ini location 4 | You should add "zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so" to php.ini -------------------------------------------------------------------------------- /php-fpm/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo "ENV Var Passed in: $DEMO_VAR" -------------------------------------------------------------------------------- /php-fpm/laravel.ini: -------------------------------------------------------------------------------- 1 | date.timezone=UTC 2 | display_errors=Off 3 | log_errors=On 4 | # extension=mongodb.so 5 | 6 | ; Maximum amount of memory a script may consume (128MB) 7 | ; http://php.net/memory-limit 8 | memory_limit = 128M 9 | ; Maximum allowed size for uploaded files. 10 | ; http://php.net/upload-max-filesize 11 | upload_max_filesize = 20M 12 | ; Sets max size of post data allowed. 13 | ; http://php.net/post-max-size 14 | post_max_size = 20M -------------------------------------------------------------------------------- /php-fpm/laravel.pool.conf: -------------------------------------------------------------------------------- 1 | ; Unix user/group of processes 2 | ; Note: The user is mandatory. If the group is not set, the default user's group 3 | ; will be used. 4 | user = www-data 5 | group = www-data 6 | 7 | ; The address on which to accept FastCGI requests. 8 | ; Valid syntaxes are: 9 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 10 | ; a specific port; 11 | ; 'port' - to listen on a TCP socket to all addresses on a 12 | ; specific port; 13 | ; '/path/to/unix/socket' - to listen on a unix socket. 14 | ; Note: This value is mandatory. 15 | listen = 0.0.0.0:9000 16 | 17 | ; Choose how the process manager will control the number of child processes. 18 | ; Possible Values: 19 | ; static - a fixed number (pm.max_children) of child processes; 20 | ; dynamic - the number of child processes are set dynamically based on the 21 | ; following directives. With this process management, there will be 22 | ; always at least 1 children. 23 | ; pm.max_children - the maximum number of children that can 24 | ; be alive at the same time. 25 | ; pm.start_servers - the number of children created on startup. 26 | ; pm.min_spare_servers - the minimum number of children in 'idle' 27 | ; state (waiting to process). If the number 28 | ; of 'idle' processes is less than this 29 | ; number then some children will be created. 30 | ; pm.max_spare_servers - the maximum number of children in 'idle' 31 | ; state (waiting to process). If the number 32 | ; of 'idle' processes is greater than this 33 | ; number then some children will be killed. 34 | ; ondemand - no children are created at startup. Children will be forked when 35 | ; new requests will connect. The following parameter are used: 36 | ; pm.max_children - the maximum number of children that 37 | ; can be alive at the same time. 38 | ; pm.process_idle_timeout - The number of seconds after which 39 | ; an idle process will be killed. 40 | ; Note: This value is mandatory. 41 | pm = dynamic 42 | 43 | ; The number of child processes to be created when pm is set to 'static' and the 44 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 45 | ; This value sets the limit on the number of simultaneous requests that will be 46 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 47 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 48 | ; CGI. The below defaults are based on a server without much resources. Don't 49 | ; forget to tweak pm.* to fit your needs. 50 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 51 | ; Note: This value is mandatory. 52 | pm.max_children = 20 53 | 54 | ; The number of child processes created on startup. 55 | ; Note: Used only when pm is set to 'dynamic' 56 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 57 | pm.start_servers = 2 58 | 59 | ; The desired minimum number of idle server processes. 60 | ; Note: Used only when pm is set to 'dynamic' 61 | ; Note: Mandatory when pm is set to 'dynamic' 62 | pm.min_spare_servers = 1 63 | 64 | ; The desired maximum number of idle server processes. 65 | ; Note: Used only when pm is set to 'dynamic' 66 | ; Note: Mandatory when pm is set to 'dynamic' 67 | pm.max_spare_servers = 3 68 | 69 | ;--------------------- 70 | 71 | ; Make specific Docker environment variables available to PHP 72 | env[DB_1_ENV_MYSQL_DATABASE] = $DB_1_ENV_MYSQL_DATABASE 73 | env[DB_1_ENV_MYSQL_USER] = $DB_1_ENV_MYSQL_USER 74 | env[DB_1_ENV_MYSQL_PASSWORD] = $DB_1_ENV_MYSQL_PASSWORD 75 | 76 | catch_workers_output = yes 77 | -------------------------------------------------------------------------------- /php-fpm/xdebug.ini: -------------------------------------------------------------------------------- 1 | zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so 2 | # zend_extension=xdebug.so 3 | xdebug.remote_autostart=1 4 | xdebug.remote_enable=1 5 | xdebug.remote_handler=dbgp 6 | xdebug.remote_mode=req 7 | xdebug.remote_port=9000 8 | xdebug.remote_host=186.4.62.170 9 | xdebug.idekey="PHPSTORM" 10 | -------------------------------------------------------------------------------- /workspace/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM phusion/baseimage:latest 2 | 3 | MAINTAINER Larry Eitel 4 | 5 | RUN DEBIAN_FRONTEND=noninteractive 6 | RUN locale-gen en_US.UTF-8 7 | 8 | ENV LANGUAGE=en_US.UTF-8 9 | ENV LC_ALL=en_US.UTF-8 10 | ENV LC_CTYPE=UTF-8 11 | ENV LANG=en_US.UTF-8 12 | ENV TERM xterm 13 | 14 | # Install "software-properties-common" (for the "add-apt-repository") 15 | RUN apt-get update && apt-get install -y \ 16 | software-properties-common 17 | 18 | # Add the "PHP 7" ppa 19 | RUN add-apt-repository -y \ 20 | ppa:ondrej/php 21 | 22 | # Install PHP-CLI 7, some PHP extentions and some useful Tools with APT 23 | RUN apt-get update && apt-get install -y --force-yes \ 24 | php7.0-cli \ 25 | php7.0-common \ 26 | php7.0-curl \ 27 | php7.0-json \ 28 | php7.0-xml \ 29 | php7.0-mbstring \ 30 | php7.0-mcrypt \ 31 | php7.0-mysql \ 32 | php7.0-pgsql \ 33 | php7.0-sqlite \ 34 | php7.0-sqlite3 \ 35 | php7.0-zip \ 36 | php7.0-memcached \ 37 | php7.0-gd \ 38 | php7.0-xdebug \ 39 | php-dev \ 40 | libcurl4-openssl-dev \ 41 | libedit-dev \ 42 | libssl-dev \ 43 | libxml2-dev \ 44 | xz-utils \ 45 | sqlite3 \ 46 | libsqlite3-dev \ 47 | git \ 48 | curl \ 49 | telnet \ 50 | vim \ 51 | nano 52 | 53 | # Clean up, to free some space 54 | RUN apt-get clean 55 | 56 | # remove load xdebug extension (only load on phpunit command) 57 | RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini 58 | 59 | # Add bin folder of composer to PATH. 60 | RUN echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc 61 | 62 | # Install Composer 63 | RUN curl -s http://getcomposer.org/installer | php \ 64 | && mv composer.phar /usr/local/bin/composer 65 | 66 | # Load xdebug Zend extension with phpunit command 67 | RUN echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc 68 | 69 | # Install mongodb extension 70 | # RUN pecl install mongodb 71 | # RUN echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini 72 | 73 | # Install nvm (Node Version Manager) 74 | RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash 75 | 76 | ENV NVM_DIR=/root/.nvm 77 | 78 | # Install stable node 79 | RUN . ~/.nvm/nvm.sh \ 80 | && nvm install stable \ 81 | && nvm use stable \ 82 | && nvm alias stable \ 83 | && npm install -g gulp bower 84 | 85 | # Source the bash 86 | RUN . ~/.bashrc 87 | 88 | # Clean up 89 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 90 | 91 | WORKDIR /var/www/laravel 92 | 93 | # Install optional software 94 | ARG INSTALL_PRESTISSIMO=false 95 | RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \ 96 | composer global require "hirak/prestissimo:^0.3"; \ 97 | fi --------------------------------------------------------------------------------