From aa0a7269450b87d7cf96462a5fb04ae6dab54956 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 25 Jun 2016 07:33:30 +0300 Subject: [PATCH 01/75] change enter container commands in the doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `docker-compose run …` to `docker exec -it …` --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc55b3f..ca4b8bc 100644 --- a/README.md +++ b/README.md @@ -221,7 +221,7 @@ You can select your own combination of container form this list: 3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...). ```bash -docker-compose run workspace bash +docker exec -it {Workspace-Container-Name} bash ``` Replace `{Workspace-Container-Name}` with your Workspace container name.
@@ -323,7 +323,7 @@ docker-compose down 2 - enter any container using: ```bash -docker-compose run {container-name} bash +docker exec -it {container-name} bash ``` 3 - to exit a container, type `exit`. @@ -494,13 +494,19 @@ You can run artisan commands and many other Terminal commands from the Workspace docker-compose up -d workspace // ..and all your other containers ``` -2 - Enter the Workspace container: +2 - Find the Workspace container name: ```bash -docker-compose run workspace /bin/bash +docker-compose ps ``` -3 - Run anything you want :) +3 - Enter the Workspace container: + +```bash +docker exec -it {workspace-container-name} bash +``` + +4 - Run anything you want :) ```bash php artisan @@ -614,7 +620,7 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins 5 - Test it: - First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent). -- Enter the Workspace Continer `docker-compose run workspace bash`. +- Enter the Workspace Container `docker exec -it laradock_workspace_1 bash`. - Migrate the Database `php artisan migrate`. From aa8be6f95b050fc18611ac548e7df42841b723b6 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 25 Jun 2016 07:36:03 +0300 Subject: [PATCH 02/75] list the contributors names in the readme @benmag @mattythebatty @AminMkh @appleboy --- README.md | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ca4b8bc..8c0aea0 100644 --- a/README.md +++ b/README.md @@ -866,8 +866,22 @@ Additionally, you can contact Mahmoud Zalt (the creator of this project) via a d ## Credits -- [Mahmoud Zalt](https://github.com/Mahmoudz) (Twitter [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt)) -- [Awesome list of contributors](https://github.com/LaraDock/laradock/graphs/contributors) +**Creator:** + +- [Mahmoud Zalt](https://github.com/Mahmoudz) (Twitter [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt)) + +**Main Contributors:** + +- [Bo-Yi Wu](https://github.com/appleboy) +- [Amin Mkh](https://github.com/AminMkh) +- [Matthew Tonkin Dunn](https://github.com/mattythebatty) +- [Benmag](https://github.com/benmag) + +**Awesome People:** + +- [Contributors](https://github.com/LaraDock/laradock/graphs/contributors) +- [Supporters](https://github.com/LaraDock/laradock/issues?utf8=%E2%9C%93&q=) + ## License From fb5ea7f42ce8664fa486ccb4fee69f6418f75e64 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sat, 25 Jun 2016 19:40:36 +0800 Subject: [PATCH 03/75] remove duplicate white spaces Signed-off-by: Bo-Yi Wu --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 8c0aea0..22d5f88 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ LaraDock and [Homestead](https://laravel.com/docs/master/homestead) both gives y - LaraDock is a tool that controls Docker for you (using Docker Compose official commands). And Docker manages you Virtual Containers. -Running a virtual Container is much faster than running a full virtual Machine. +Running a virtual Container is much faster than running a full virtual Machine.
Thus **LaraDock is much faster than Homestead**. @@ -163,7 +163,7 @@ Running a virtual Container is much faster than running a full virtual Machine. ## Demo Video -What's better than a [**Demo Video**](https://www.youtube.com/watch?v=-DamFMczwDA) :) +What's better than a [**Demo Video**](https://www.youtube.com/watch?v=-DamFMczwDA) :) ## Installation @@ -190,7 +190,7 @@ git clone https://github.com/LaraDock/laradock.git ## Usage -1 - For **Windows & MAC** users only: If you are not using the native Docker-Engine `Beta`, make sure you have a running Docker Virtual Host on your machine. +1 - For **Windows & MAC** users only: If you are not using the native Docker-Engine `Beta`, make sure you have a running Docker Virtual Host on your machine. [How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host) (**Linux** users don't need a Virtual Host, so skip this step). @@ -223,7 +223,7 @@ You can select your own combination of container form this list: ```bash docker exec -it {Workspace-Container-Name} bash ``` -Replace `{Workspace-Container-Name}` with your Workspace container name. +Replace `{Workspace-Container-Name}` with your Workspace container name.
To find the containers names type `docker-compose ps`. @@ -306,7 +306,7 @@ docker-compose stop {container-name} docker-compose down ``` -*Note: Careful with this command as it will delete your Data Volume Container as well. (if you want to keep your Database data than you should stop each container by itself as follow):* +*Note: Careful with this command as it will delete your Data Volume Container as well. (if you want to keep your Database data than you should stop each container by itself as follow):* @@ -338,7 +338,7 @@ docker exec -it {container-name} bash ### Edit default container configuration Open the `docker-compose.yml` and change anything you want. -Examples: +Examples: Change MySQL Database Name: @@ -365,7 +365,7 @@ Change Redis defaut port to 1111: ### Edit a Docker Image -1 - Find the `dockerfile` of the image you want to edit, +1 - Find the `dockerfile` of the image you want to edit,
example for `mysql` it will be `mysql/Dockerfile`. @@ -424,7 +424,7 @@ To add an image (software), just edit the `docker-compose.yml` and add your cont
-### View the Log files +### View the Log files The Nginx Log file is stored in the `logs/nginx` directory. However to view the logs of all the other containers (MySQL, PHP-FPM,...) you can run this: @@ -464,7 +464,7 @@ For more about the Laravel installation click [here](https://laravel.com/docs/ma 3 - Edit `docker-compose.yml` to Map the new application path: -By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. +By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder. Since the new Laravel application is in the `my-cool-app` folder, we need to replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow: @@ -497,7 +497,7 @@ docker-compose up -d workspace // ..and all your other containers 2 - Find the Workspace container name: ```bash -docker-compose ps +docker-compose ps ``` 3 - Enter the Workspace container: @@ -665,11 +665,11 @@ By default **PHP-FPM 7.0** is running. 2 - Search for `Dockerfile-70` in the PHP container section. -3 - Change the version number. +3 - Change the version number.
Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`. -Sample: +Sample: ```txt php-fpm: @@ -761,9 +761,9 @@ eval $(docker-machine env)
-### Find your Docker IP Address +### Find your Docker IP Address -**On Windows & MAC:** +**On Windows & MAC:** Run this command in your terminal: @@ -779,7 +779,7 @@ If your Host name is different then `default`, you have to specify it (`docker-m > **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*.
-**On Linux:** +**On Linux:** Run this command in your terminal: From 62878e7c498efd16c71489d4b0127542f2ad4d9d Mon Sep 17 00:00:00 2001 From: zhikiri Date: Mon, 27 Jun 2016 11:30:25 +0300 Subject: [PATCH 04/75] Added supporting of the mcrypt extenstion --- php-fpm/Dockerfile-55 | 4 ++++ php-fpm/Dockerfile-56 | 4 ++++ php-fpm/Dockerfile-70 | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/php-fpm/Dockerfile-55 b/php-fpm/Dockerfile-55 index ae4dbdb..f37f4d7 100644 --- a/php-fpm/Dockerfile-55 +++ b/php-fpm/Dockerfile-55 @@ -11,9 +11,13 @@ RUN apt-get update && apt-get install -y \ curl \ libpng12-dev \ libfreetype6-dev \ + libmcrypt-dev \ --no-install-recommends \ && rm -r /var/lib/apt/lists/* +# install mcrypt library +RUN docker-php-ext-install mcrypt + # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index f14a16f..a5041dd 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -11,9 +11,13 @@ RUN apt-get update && apt-get install -y \ curl \ libpng12-dev \ libfreetype6-dev \ + libmcrypt-dev \ --no-install-recommends \ && rm -r /var/lib/apt/lists/* +# install mcrypt library +RUN docker-php-ext-install mcrypt + # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index d046d27..7411323 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -11,9 +11,13 @@ RUN apt-get update && apt-get install -y \ curl \ libpng12-dev \ libfreetype6-dev \ + libmcrypt-dev \ --no-install-recommends \ && rm -r /var/lib/apt/lists/* +# install mcrypt library +RUN docker-php-ext-install mcrypt + # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ From de6db93da8b08425a3e70726385a9144e4334524 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 27 Jun 2016 13:58:48 +0300 Subject: [PATCH 05/75] Fix conflict merging zhikiri-hotfix/mongo-support --- php-fpm/Dockerfile-55 | 7 ++++--- php-fpm/Dockerfile-56 | 7 ++++--- php-fpm/Dockerfile-70 | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/php-fpm/Dockerfile-55 b/php-fpm/Dockerfile-55 index f37f4d7..977f253 100644 --- a/php-fpm/Dockerfile-55 +++ b/php-fpm/Dockerfile-55 @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ curl \ libpng12-dev \ libfreetype6-dev \ + libssl-dev \ libmcrypt-dev \ --no-install-recommends \ && rm -r /var/lib/apt/lists/* @@ -18,6 +19,9 @@ RUN apt-get update && apt-get install -y \ # install mcrypt library RUN docker-php-ext-install mcrypt +# Install mongodb driver +RUN pecl install mongodb + # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ @@ -37,9 +41,6 @@ RUN pecl install memcached \ RUN pecl install xdebug \ && docker-php-ext-enable xdebug -# Install mongodb driver -RUN pecl install mongodb - RUN usermod -u 1000 www-data WORKDIR /var/www/laravel diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index a5041dd..da7de7a 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ curl \ libpng12-dev \ libfreetype6-dev \ + libssl-dev \ libmcrypt-dev \ --no-install-recommends \ && rm -r /var/lib/apt/lists/* @@ -18,6 +19,9 @@ RUN apt-get update && apt-get install -y \ # install mcrypt library RUN docker-php-ext-install mcrypt +# Install mongodb driver +RUN pecl install mongodb + # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ @@ -37,9 +41,6 @@ RUN pecl install memcached \ RUN pecl install xdebug \ && docker-php-ext-enable xdebug -# Install mongodb driver -RUN pecl install mongodb - RUN usermod -u 1000 www-data WORKDIR /var/www/laravel diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 7411323..17c1e3f 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \ curl \ libpng12-dev \ libfreetype6-dev \ + libssl-dev \ libmcrypt-dev \ --no-install-recommends \ && rm -r /var/lib/apt/lists/* @@ -18,6 +19,9 @@ RUN apt-get update && apt-get install -y \ # install mcrypt library RUN docker-php-ext-install mcrypt +# Install mongodb driver +RUN pecl install mongodb + # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ @@ -41,9 +45,6 @@ RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-m RUN pecl install xdebug \ && docker-php-ext-enable xdebug -# Install mongodb driver -RUN pecl install mongodb - RUN usermod -u 1000 www-data WORKDIR /var/www/laravel From e0b4734dab6e0cee8f176107c0cc2aa3da67065a Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 28 Jun 2016 17:18:37 +0800 Subject: [PATCH 06/75] Added support upload file size setting. Signed-off-by: Bo-Yi Wu --- nginx/nginx.conf | 1 + php-fpm/laravel.ini | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 17ac882..3e8dadd 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -15,6 +15,7 @@ http { tcp_nodelay on; keepalive_timeout 15; types_hash_max_size 2048; + client_max_body_size 20M; include /etc/nginx/mime.types; default_type application/octet-stream; access_log on; diff --git a/php-fpm/laravel.ini b/php-fpm/laravel.ini index b31c55b..186c8e1 100644 --- a/php-fpm/laravel.ini +++ b/php-fpm/laravel.ini @@ -2,3 +2,13 @@ date.timezone=UTC display_errors=Off log_errors=On extension=mongodb.so + +; Maximum amount of memory a script may consume (128MB) +; http://php.net/memory-limit +memory_limit = 128M +; Maximum allowed size for uploaded files. +; http://php.net/upload-max-filesize +upload_max_filesize = 20M +; Sets max size of post data allowed. +; http://php.net/post-max-size +post_max_size = 20M From 3a714339da718a5b76d7a8fdbe4d05b21ecb3942 Mon Sep 17 00:00:00 2001 From: Niksac Date: Thu, 7 Jul 2016 15:29:00 +0200 Subject: [PATCH 07/75] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 22d5f88..e4b5f5b 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Seriously!!! Instead of providing a full Virtual Machines, like you get with Vagrant, Docker provides you **lightweight** Virtual Containers, that share the same kernel and allow to safely execute independent processes. -In addition to the speed, Docker gives tens of features that cannot be achieved with Vagrant. +In addition to the speed, Docker gives tons of features that cannot be achieved with Vagrant. Most importantly Docker can run on Development and on Production (same environment everywhere). While Vagrant is designed for Development only, (so you have to re-provision your server on Production every time). From 11c65c4a006124a1fcaf846710d3516b6ce2023d Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Tue, 12 Jul 2016 15:00:21 +0100 Subject: [PATCH 08/75] Fix variable not set warning Added an untracked `.env` file to the root directory to prevent the `WARNING: The INSTALL_PRESTISSIMO variable is not set` message from being displayed when `docker-compose` is run. Added section in README for optional features. --- .env | 1 + README.md | 8 ++++++++ docker-compose.yml | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..5b53677 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +INSTALL_PRESTISSIMO=false \ No newline at end of file diff --git a/README.md b/README.md index e4b5f5b..c8545e4 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) + - [Optional Features](#Optional-Features) - [Debugging](#debugging) - [Help & Questions](#Help) @@ -822,6 +823,13 @@ server_name laravel.dev; ``` +
+ +### Optional Features +#### prestissimo +[prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `.env` file in the Laradock directory. + +
### Debugging diff --git a/docker-compose.yml b/docker-compose.yml index 087cea3..9d13ae6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -156,7 +156,7 @@ services: build: context: ./workspace args: - INSTALL_PRESTISSIMO: ${INSTALL_PRESTISSIMO} + - INSTALL_PRESTISSIMO=${INSTALL_PRESTISSIMO} volumes_from: - application tty: true From d01d0874312b56025c9ceb40135926d3b74ccb36 Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Tue, 12 Jul 2016 16:38:20 +0100 Subject: [PATCH 09/75] Added more detail to the README --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8545e4..bc9d157 100644 --- a/README.md +++ b/README.md @@ -826,9 +826,10 @@ server_name laravel.dev;
### Optional Features -#### prestissimo -[prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `.env` file in the Laradock directory. +Optional features can be enabled by changing the `.env` file in the Laradock directory. +#### prestissimo +[prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `.env` file.
From 42d63236f18427a8dce6c5f813e78b9af9dd27c2 Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Tue, 12 Jul 2016 16:39:08 +0100 Subject: [PATCH 10/75] Changed the data container volume mappings All of the database data volume mapping have been changed from the host's `/var/lib` directory to locally alongside the laradock installation. This should hopefully prevent issues where data disappears after containers are restarted or data on the host machine is overwritten by accident (scary!) Additionally this should make data easier to backup between installations - especially on Windows where `/var` does not exist and is created transparently by Docker Machine/Windows beta. This change will most likely cause data to disappear from existing installations, however it may reappear if moved to it's new home. References #137, #138 --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9d13ae6..4a8873f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,13 +27,13 @@ services: data: build: ./data volumes: - - /var/lib/mysql:/var/lib/mysql - - /var/lib/postgres:/var/lib/postgres - - /var/lib/mariadb:/var/lib/mariadb - - /var/lib/memcached:/var/lib/memcached - - /var/lib/redis:/data - - /var/lib/neo4j:/var/lib/neo4j/data - - /var/lib/mongo:/data/db + - ./mysql:/var/lib/mysql + - ./postgres:/var/lib/postgres + - ./mariadb:/var/lib/mariadb + - ./memcached:/var/lib/memcached + - ./redis:/data + - ./neo4j:/var/lib/neo4j/data + - ./mongo:/data/db ### Nginx Server Container ################################## From 14cbe9f935ad97e127a08c2f0f48e1b5afbe5e88 Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Tue, 12 Jul 2016 17:11:57 +0100 Subject: [PATCH 11/75] Moved volume container definitions I've placed the `application` and `data` directories into a `volumes` subdirectory. The top level `data` directory is now used for storing the data used by the database (and other, if any) containers. The `data` directory has also been added to the `.gitignore` file to prevent accidental pushing of user data. --- .gitignore | 1 + docker-compose.yml | 42 +++++++++---------- .../application}/Dockerfile | 0 {data => volumes/data}/Dockerfile | 0 4 files changed, 22 insertions(+), 21 deletions(-) rename {application => volumes/application}/Dockerfile (100%) rename {data => volumes/data}/Dockerfile (100%) diff --git a/.gitignore b/.gitignore index b152f57..28b085f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /logs +/data .env \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 4a8873f..cebd213 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: context: ./php-fpm dockerfile: Dockerfile-70 volumes_from: - - application + - volumes_data expose: - "9000" links: @@ -17,30 +17,30 @@ services: ### Laravel Application Code Container ###################### - application: - build: ./application + volumes_source: + build: ./volumes/application volumes: - ../:/var/www/laravel ### Databases Data Container ################################ - data: - build: ./data + volumes_data: + build: ./volumes/data volumes: - - ./mysql:/var/lib/mysql - - ./postgres:/var/lib/postgres - - ./mariadb:/var/lib/mariadb - - ./memcached:/var/lib/memcached - - ./redis:/data - - ./neo4j:/var/lib/neo4j/data - - ./mongo:/data/db + - ./data/mysql:/var/lib/mysql + - ./data/postgres:/var/lib/postgres + - ./data/mariadb:/var/lib/mariadb + - ./data/memcached:/var/lib/memcached + - ./data/redis:/data + - ./data/neo4j:/var/lib/neo4j/data + - ./data/mongo:/data/db ### Nginx Server Container ################################## nginx: build: ./nginx volumes_from: - - application + - volumes_source volumes: - ./logs/nginx/:/var/log/nginx ports: @@ -54,7 +54,7 @@ services: mysql: build: ./mysql volumes_from: - - data + - volumes_data ports: - "3306:3306" environment: @@ -68,7 +68,7 @@ services: postgres: build: ./postgres volumes_from: - - data + - volumes_data ports: - "5432:5432" environment: @@ -81,7 +81,7 @@ services: mariadb: build: ./mariadb volumes_from: - - data + - volumes_data ports: - "3306:3306" environment: @@ -100,7 +100,7 @@ services: environment: - NEO4J_AUTH=homestead:secret volumes_from: - - data + - volumes_data ### MongoDB Container ####################################### @@ -109,14 +109,14 @@ services: ports: - "27017:27017" volumes_from: - - data + - volumes_data ### Redis Container ######################################### redis: build: ./redis volumes_from: - - data + - volumes_data ports: - "6379:6379" @@ -125,7 +125,7 @@ services: memcached: build: ./memcached volumes_from: - - data + - volumes_data ports: - "11211:11211" links: @@ -158,7 +158,7 @@ services: args: - INSTALL_PRESTISSIMO=${INSTALL_PRESTISSIMO} volumes_from: - - application + - volumes_data tty: true ### Add more Containers below ############################### diff --git a/application/Dockerfile b/volumes/application/Dockerfile similarity index 100% rename from application/Dockerfile rename to volumes/application/Dockerfile diff --git a/data/Dockerfile b/volumes/data/Dockerfile similarity index 100% rename from data/Dockerfile rename to volumes/data/Dockerfile From 11cdfd440bda8ee7d527467d3c6f11a59825bd87 Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Tue, 12 Jul 2016 17:46:46 +0100 Subject: [PATCH 12/75] Updated README References #135 --- README.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index bc9d157..3dde06f 100644 --- a/README.md +++ b/README.md @@ -828,8 +828,8 @@ server_name laravel.dev; ### Optional Features Optional features can be enabled by changing the `.env` file in the Laradock directory. -#### prestissimo -[prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `.env` file. +#### Prestissimo +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable Prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `.env` file.
@@ -837,24 +837,21 @@ Optional features can be enabled by changing the `.env` file in the Laradock dir *Here's a list of the common problems you might face, and the possible solutions.* -#### + I see a blank (white) page instead of the Laravel 'Welcome' page! +#### I see a blank (white) page instead of the Laravel 'Welcome' page! -run this command from the Laravel root directory: +Run the following command from the Laravel root directory: ```bash sudo chmod -R 777 storage bootstrap/cache ``` -#### + I see "Welcome to nginx" instead of the Laravel App! - -use `http://127.0.0.1` instead of `http://localhost` in your browser. - - - - +#### I see "Welcome to nginx" instead of the Laravel App! +Use `http://127.0.0.1` (or [your Docker IP](#Find-Docker-IP-Address)) instead of `http://localhost` in your browser. +#### I see an error message containing `address already in use` +Make sure the ports for the services that you are trying to run (80, 3306, etc.) are not being used already by other programs, such as a built in `apache`/`httpd` service or other development tools you have installed.
From 48a53f1d246fbced4c45ed711a9c8cedaa7f2eca Mon Sep 17 00:00:00 2001 From: Yew JS Date: Wed, 13 Jul 2016 14:12:32 +0800 Subject: [PATCH 13/75] Update Dockerfile-70 install libJPEG and enabled in GD --- php-fpm/Dockerfile-70 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 17c1e3f..34356be 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \ libpq-dev \ libmemcached-dev \ curl \ + libjpeg-dev \ libpng12-dev \ libfreetype6-dev \ libssl-dev \ @@ -25,6 +26,7 @@ RUN pecl install mongodb # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ + --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 # Install extensions using the helper script provided by the base image From 5f99478c763b6b63f4ed72c535d0f89ef911a429 Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Wed, 13 Jul 2016 10:08:13 +0100 Subject: [PATCH 14/75] Fixed workspace container mapping volumes to wrong container --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index cebd213..e497575 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -158,7 +158,7 @@ services: args: - INSTALL_PRESTISSIMO=${INSTALL_PRESTISSIMO} volumes_from: - - volumes_data + - volumes_source tty: true ### Add more Containers below ############################### From dca05452937a4672c2f9db1b6fb3e40c64675afa Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Wed, 13 Jul 2016 10:44:17 +0100 Subject: [PATCH 15/75] Fixed incorrect `php-fpm` container mapping --- docker-compose.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e497575..f736404 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,19 +2,6 @@ version: '2' services: -### PHP-FPM Container ####################################### - - php-fpm: - build: - context: ./php-fpm - dockerfile: Dockerfile-70 - volumes_from: - - volumes_data - expose: - - "9000" - links: - - workspace - ### Laravel Application Code Container ###################### volumes_source: @@ -49,6 +36,19 @@ services: links: - php-fpm +### PHP-FPM Container ####################################### + + php-fpm: + build: + context: ./php-fpm + dockerfile: Dockerfile-70 + volumes_from: + - volumes_source + expose: + - "9000" + links: + - workspace + ### MySQL Container ######################################### mysql: From 2df00ecdadc1d3d97c9b5ac1a56692e687467a06 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 13 Jul 2016 16:00:47 +0300 Subject: [PATCH 16/75] remove installing Prestissimo by default, to prevent the warning --- README.md | 12 ++++++------ docker-compose.yml | 42 +++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 3dde06f..a6ac206 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) - - [Optional Features](#Optional-Features) + - [Install-Prestissimo](#Install-Prestissimo) - [Debugging](#debugging) - [Help & Questions](#Help) @@ -260,6 +260,7 @@ If you need a special support. Contact me, more details in the [Help & Questions ## Documentation +**Note:** this documentation doesn't cover the Docker Beta *(Native Docker on MAC and Windows)*. However, the commands are very similar. We are planning to cover the Docker Beta soon. @@ -824,12 +825,10 @@ server_name laravel.dev;
- -### Optional Features -Optional features can be enabled by changing the `.env` file in the Laradock directory. + +### Install Prestissimo -#### Prestissimo -[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable Prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `.env` file. +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable Prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `docker-compose.yml` file.
@@ -878,6 +877,7 @@ Additionally, you can contact Mahmoud Zalt (the creator of this project) via a d **Main Contributors:** +- [Jack Fletcher](https://github.com/Kauhat) - [Bo-Yi Wu](https://github.com/appleboy) - [Amin Mkh](https://github.com/AminMkh) - [Matthew Tonkin Dunn](https://github.com/mattythebatty) diff --git a/docker-compose.yml b/docker-compose.yml index f736404..7b2483f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,26 +2,6 @@ version: '2' services: -### Laravel Application Code Container ###################### - - volumes_source: - build: ./volumes/application - volumes: - - ../:/var/www/laravel - -### Databases Data Container ################################ - - volumes_data: - build: ./volumes/data - volumes: - - ./data/mysql:/var/lib/mysql - - ./data/postgres:/var/lib/postgres - - ./data/mariadb:/var/lib/mariadb - - ./data/memcached:/var/lib/memcached - - ./data/redis:/data - - ./data/neo4j:/var/lib/neo4j/data - - ./data/mongo:/data/db - ### Nginx Server Container ################################## nginx: @@ -156,9 +136,29 @@ services: build: context: ./workspace args: - - INSTALL_PRESTISSIMO=${INSTALL_PRESTISSIMO} + - INSTALL_PRESTISSIMO=false volumes_from: - volumes_source tty: true +### Laravel Application Code Container ###################### + + volumes_source: + build: ./volumes/application + volumes: + - ../:/var/www/laravel + +### Databases Data Container ################################ + + volumes_data: + build: ./volumes/data + volumes: + - ./data/mysql:/var/lib/mysql + - ./data/postgres:/var/lib/postgres + - ./data/mariadb:/var/lib/mariadb + - ./data/memcached:/var/lib/memcached + - ./data/redis:/data + - ./data/neo4j:/var/lib/neo4j/data + - ./data/mongo:/data/db + ### Add more Containers below ############################### From 68576f9022df23bf9f28cf9f17855aa207bd8e70 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 13 Jul 2016 17:04:06 +0300 Subject: [PATCH 17/75] fix the volumes mapping --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7b2483f..8e9ac06 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -153,12 +153,12 @@ services: volumes_data: build: ./volumes/data volumes: - - ./data/mysql:/var/lib/mysql - - ./data/postgres:/var/lib/postgres - - ./data/mariadb:/var/lib/mariadb - - ./data/memcached:/var/lib/memcached - - ./data/redis:/data - - ./data/neo4j:/var/lib/neo4j/data - - ./data/mongo:/data/db + - /var/lib/mysql:/var/lib/mysql + - /var/lib/postgres:/var/lib/postgres + - /var/lib/mariadb:/var/lib/mariadb + - /var/lib/memcached:/var/lib/memcached + - /var/lib/redis:/data + - /var/lib/neo4j:/var/lib/neo4j/data + - /var/lib/mongo:/data/db ### Add more Containers below ############################### From 2d382b683a0661476b67721286e02743e9d95d5b Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 14 Jul 2016 04:27:45 +0300 Subject: [PATCH 18/75] general updates to the readme --- README.md | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index a6ac206..e1c76a1 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ LaraDock helps you run your **Laravel** App on **Docker** real quick.
It's like Laravel Homestead but for Docker instead of Vagrant. +>With LaraDock, use Docker first and learn about it later. ![](http://s18.postimg.org/fhykchl09/new_laradock_cover.png) @@ -49,7 +50,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) - - [Install-Prestissimo](#Install-Prestissimo) + - [Install Prestissimo](#Install-Prestissimo) - [Debugging](#debugging) - [Help & Questions](#Help) @@ -99,7 +100,7 @@ docker-compose up nginx mysql redis - Memcached - Beanstalkd - Beanstalkd Console -- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano and cURL) +- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano, cURL and much more) - Data *(Databases Data Container)* - Application *(Application Code Container)* @@ -113,7 +114,7 @@ docker-compose up nginx mysql redis ### What is Docker? -[Docker](https://www.docker.com) is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of [operating-system-level virtualization](https://en.wikipedia.org/wiki/Operating-system-level_virtualization) on Linux, Mac OS and Windows. +[Docker](https://www.docker.com) is an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of [operating-system-level virtualization](https://en.wikipedia.org/wiki/Operating-system-level_virtualization) on Linux, Mac OS and Windows. ### What is Laravel? @@ -140,26 +141,21 @@ LaraDock and [Homestead](https://laravel.com/docs/master/homestead) both gives y - Homestead is a tool that controls Vagrant for you (using Homestead special commands). And Vagrant manages your Virtual Machine. -- LaraDock is a tool that controls Docker for you (using Docker Compose official commands). And Docker manages you Virtual Containers. +- LaraDock is a tool that controls Docker for you (using Docker & Docker Compose official commands). And Docker manages your Virtual Containers. -Running a virtual Container is much faster than running a full virtual Machine. -
Thus **LaraDock is much faster than Homestead**. +Running a virtual Container is much faster than running a full virtual Machine. Thus **LaraDock is much faster than Homestead**. ## Requirements -| Linux | Windows & MAC | -|-----------------------------------------------------------------------------------------|---------------------------------------------------------| -| [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) | -| [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) | -| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux) | [Docker Toolbox](https://www.docker.com/toolbox) | -| [Docker Compose](https://docs.docker.com/compose/install) | | - - - - +| Linux | Windows & MAC | +|--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| +| [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) | +| [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) | +| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux) | [Docker Toolbox](https://www.docker.com/toolbox) OR [Native Docker](https://beta.docker.com/) | +| [Docker Compose](https://docs.docker.com/compose/install) | | ## Demo Video From 16b82d066e5ba7ccd47fef715d377a9a64d854f2 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Thu, 14 Jul 2016 09:56:05 +0800 Subject: [PATCH 19/75] #140 update php 5.5 and 5.6 Signed-off-by: Bo-Yi Wu --- php-fpm/Dockerfile-55 | 2 ++ php-fpm/Dockerfile-56 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/php-fpm/Dockerfile-55 b/php-fpm/Dockerfile-55 index 977f253..922cfad 100644 --- a/php-fpm/Dockerfile-55 +++ b/php-fpm/Dockerfile-55 @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \ libpq-dev \ libmemcached-dev \ curl \ + libjpeg-dev \ libpng12-dev \ libfreetype6-dev \ libssl-dev \ @@ -25,6 +26,7 @@ RUN pecl install mongodb # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ + --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 # Install extensions using the helper script provided by the base image diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index da7de7a..a725797 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \ libpq-dev \ libmemcached-dev \ curl \ + libjpeg-dev \ libpng12-dev \ libfreetype6-dev \ libssl-dev \ @@ -25,6 +26,7 @@ RUN pecl install mongodb # configure gd library RUN docker-php-ext-configure gd \ --enable-gd-native-ttf \ + --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 # Install extensions using the helper script provided by the base image From d75a43c615911f837ae155f4efa083bcd6e29527 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Sat, 16 Jul 2016 13:07:56 -0500 Subject: [PATCH 20/75] Update Dockerfile-70 fixes memcached extension not installing --- php-fpm/Dockerfile-70 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 34356be..b6df086 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -37,11 +37,18 @@ RUN docker-php-ext-install \ # Install Memcached for php 7 RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ - && mkdir -p /usr/src/php/ext/memcached \ - && tar -C /usr/src/php/ext/memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ - && docker-php-ext-configure memcached \ - && docker-php-ext-install memcached \ - && rm /tmp/memcached.tar.gz + && mkdir -p memcached \ + && tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ + && ( \ + cd memcached \ + && phpize \ + && ./configure \ + && make -j$(nproc) \ + && make install \ + ) \ + && rm -r memcached \ + && rm /tmp/memcached.tar.gz \ + && docker-php-ext-enable memcached # Install xdebug RUN pecl install xdebug \ From 9b084433c34c9303703d6b8881e6ee89bdf36327 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 19 Jul 2016 21:51:20 -0500 Subject: [PATCH 21/75] add caddy server. --- README.md | 3 ++- caddy/Caddyfile | 9 +++++++++ caddy/Dockerfile | 20 ++++++++++++++++++++ docker-compose.yml | 16 ++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 caddy/Caddyfile create mode 100644 caddy/Dockerfile diff --git a/README.md b/README.md index e1c76a1..0268357 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ docker-compose up nginx mysql redis - Memcached - Beanstalkd - Beanstalkd Console +- Caddy - Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano, cURL and much more) - Data *(Databases Data Container)* - Application *(Application Code Container)* @@ -205,7 +206,7 @@ docker-compose up -d nginx mysql You can select your own combination of container form this list: -`nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`, `data`, `php-fpm`, `application`. +`nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `caddy`, `workspace`, `data`, `php-fpm`, `application`. **Note**: `workspace`, `data`, `php-fpm` and `application` will run automatically in most of the cases. diff --git a/caddy/Caddyfile b/caddy/Caddyfile new file mode 100644 index 0000000..b7615c2 --- /dev/null +++ b/caddy/Caddyfile @@ -0,0 +1,9 @@ +# Docs: https://caddyserver.com/docs/caddyfile +0.0.0.0:80 +fastcgi / php-fpm:9000 php +browse +log stdout +errors stdout +# Uncomment to enable TLS (HTTPS) +# Change the first list to listen on port 443 when enabling TLS +#tls self_signed diff --git a/caddy/Dockerfile b/caddy/Dockerfile new file mode 100644 index 0000000..9de6557 --- /dev/null +++ b/caddy/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.4 +MAINTAINER Eric Pfeiffer + +LABEL caddy_version="0.9.0" architecture="amd64" + +RUN apk add --update openssh-client tar curl + +RUN curl --silent --show-error --fail --location \ + --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ + "https://github.com/mholt/caddy/releases/download/v0.9.0/caddy_linux_amd64.tar.gz" \ + | tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \ + && mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \ + && chmod 0755 /usr/bin/caddy \ + && /usr/bin/caddy -version + +EXPOSE 80 443 2015 +WORKDIR /var/www/laravel/public + +ENTRYPOINT ["caddy"] +CMD ["-conf", "/etc/Caddyfile"] diff --git a/docker-compose.yml b/docker-compose.yml index 8e9ac06..32bfddc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -160,5 +160,21 @@ services: - /var/lib/redis:/data - /var/lib/neo4j:/var/lib/neo4j/data - /var/lib/mongo:/data/db + +### Caddy Server Container ################################## +# Edit the Caddyfile if needed (./caddy/Caddyfile) + + caddy: + build: ./caddy + volumes_from: + - application + ports: + - "80:80" + - "443:443" + - "2015:2015" + volumes: + - ./caddy/Caddyfile:/etc/Caddyfile + links: + - php-fpm ### Add more Containers below ############################### From 9e7a669d5b84a0043e98f8c8243774626b9b1862 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 19 Jul 2016 22:01:20 -0500 Subject: [PATCH 22/75] incorporate upstream changes. --- caddy/Dockerfile | 4 +++- docker-compose.yml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/caddy/Dockerfile b/caddy/Dockerfile index 9de6557..0694237 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -3,7 +3,9 @@ MAINTAINER Eric Pfeiffer LABEL caddy_version="0.9.0" architecture="amd64" -RUN apk add --update openssh-client tar curl +RUN apk update \ + && apk upgrade \ + && apk add tar curl RUN curl --silent --show-error --fail --location \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ diff --git a/docker-compose.yml b/docker-compose.yml index 32bfddc..0426195 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -167,7 +167,7 @@ services: caddy: build: ./caddy volumes_from: - - application + - volumes_source ports: - "80:80" - "443:443" From 5bcbe0d291ac8f7d7ce3346f970304c521771831 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 19 Jul 2016 22:16:36 -0500 Subject: [PATCH 23/75] add rewrite rule to fix 404 errors when navigating to different pages. --- caddy/Caddyfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index b7615c2..d8f6a5d 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -1,6 +1,9 @@ # Docs: https://caddyserver.com/docs/caddyfile 0.0.0.0:80 fastcgi / php-fpm:9000 php +rewrite { + to /index.php?{query} +} browse log stdout errors stdout From a96ee886926c4afbdafbd8d438619af1ed97f930 Mon Sep 17 00:00:00 2001 From: Orette D'Aguilar Date: Wed, 20 Jul 2016 15:59:50 -0500 Subject: [PATCH 24/75] Added pkg-config to the PHP extentions and Tools that are installed from APT --- workspace/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 9e12b10..1ab341f 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -47,7 +47,8 @@ RUN apt-get update && apt-get install -y --force-yes \ git \ curl \ vim \ - nano + nano \ + pkg-config # Clean up, to free some space RUN apt-get clean @@ -93,4 +94,4 @@ WORKDIR /var/www/laravel ARG INSTALL_PRESTISSIMO=false RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \ composer global require "hirak/prestissimo:^0.3"; \ - fi \ No newline at end of file + fi From c7fae1a8078270757555d6fc91f5917f60260a22 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Thu, 21 Jul 2016 11:05:52 +0800 Subject: [PATCH 25/75] convert tab to space. --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 1ab341f..516344f 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -48,7 +48,7 @@ RUN apt-get update && apt-get install -y --force-yes \ curl \ vim \ nano \ - pkg-config + pkg-config # Clean up, to free some space RUN apt-get clean From 63b9ec2bd88460bbcec0e506450fd8f1e2a16928 Mon Sep 17 00:00:00 2001 From: Orette D'Aguilar Date: Thu, 21 Jul 2016 09:48:21 -0500 Subject: [PATCH 26/75] Added dot file to maintain consistent coding styles --- .editorconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..87ac011 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*] +charset = utf-8 + +[{Dockerfile,docker-compose.yml}] +indent_style = space +indent_size = 4 From 4d2452101aa8961dc5dfc9aa9e87fcf4bb67caaf Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 22 Jul 2016 00:36:26 +0300 Subject: [PATCH 27/75] add more awesome people to the contributors list --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0268357..2425e0c 100644 --- a/README.md +++ b/README.md @@ -874,10 +874,13 @@ Additionally, you can contact Mahmoud Zalt (the creator of this project) via a d **Main Contributors:** -- [Jack Fletcher](https://github.com/Kauhat) -- [Bo-Yi Wu](https://github.com/appleboy) -- [Amin Mkh](https://github.com/AminMkh) -- [Matthew Tonkin Dunn](https://github.com/mattythebatty) +- [Eric Pfeiffer (computerfr33k)](https://github.com/computerfr33k) +- [Orette](https://github.com/orette) +- [Jack Fletcher (Kauhat)](https://github.com/Kauhat) +- [Bo-Yi Wu (appleboy)](https://github.com/appleboy) +- [Amin Mkh (AminMkh)](https://github.com/AminMkh) +- [Matthew Tonkin Dunn (mattythebatty)](https://github.com/mattythebatty) +- [Zhivitsa Kirill (zhikiri)](https://github.com/zhikiri) - [Benmag](https://github.com/benmag) **Awesome People:** From 4dda3b969e31fe54fba54232ce3d27a7cbbfbeb5 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sat, 23 Jul 2016 19:53:16 +0300 Subject: [PATCH 28/75] add gitter link to the readme --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2425e0c..fd1d57d 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![forthebadge](http://forthebadge.com/images/badges/built-by-developers.svg)](http://zalt.me) +[![Gitter](https://badges.gitter.im/LaraDock/laradock.svg)](https://gitter.im/LaraDock/laradock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) LaraDock helps you run your **Laravel** App on **Docker** real quick.
@@ -9,6 +10,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. >With LaraDock, use Docker first and learn about it later. + ![](http://s18.postimg.org/fhykchl09/new_laradock_cover.png)
@@ -859,12 +861,11 @@ This little project was built by one man who has a full time job and many respon ## Help & Questions -If you need any help with Docker and Laravel, you can schedule a live call with the creator of this project at [Codementor.io](https://www.codementor.io/mahmoudz), He would love to help. +Join the chat room on [Gitter](https://gitter.im/LaraDock/laradock) and get help and support from the community. -For general questions you can open [Issues](https://github.com/laradock/laradock/issues) here on Github (We will label them as questions). - -Additionally, you can contact Mahmoud Zalt (the creator of this project) via a direct message on LaraChat, (his username is `mahmoud_zalt`). Or send him an email (`mahmoud@zalt.me`). +You can as well can open an [issue](https://github.com/laradock/laradock/issues) on Github (will be labeled as Question) and discuss it with people on [Gitter](https://gitter.im/LaraDock/laradock). +For special help with Docker and/or Laravel, you can schedule a live call with the creator of this project at [Codementor.io](https://www.codementor.io/mahmoudz). ## Credits From ef8579987f98a7eec8bbbae6e85dba7f2a679fe7 Mon Sep 17 00:00:00 2001 From: orette Date: Sun, 24 Jul 2016 02:49:57 +0000 Subject: [PATCH 29/75] Added HHVM container and used environment variable for switching --- .env | 3 ++- docker-compose.yml | 18 ++++++++++++++++-- hhvm/Dockerfile | 21 +++++++++++++++++++++ hhvm/server.ini | 20 ++++++++++++++++++++ nginx/Dockerfile | 4 +++- 5 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 hhvm/Dockerfile create mode 100644 hhvm/server.ini diff --git a/.env b/.env index 5b53677..43554f3 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -INSTALL_PRESTISSIMO=false \ No newline at end of file +INSTALL_PRESTISSIMO=false +PHP_PROCESS_MANAGER=php-fpm diff --git a/docker-compose.yml b/docker-compose.yml index 0426195..4f225f2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,10 @@ services: ### Nginx Server Container ################################## nginx: - build: ./nginx + build: + context: ./nginx + args: + - PHP_UPSTREAM=${PHP_PROCESS_MANAGER} volumes_from: - volumes_source volumes: @@ -14,7 +17,7 @@ services: - "80:80" - "443:443" links: - - php-fpm + - ${PHP_PROCESS_MANAGER} ### PHP-FPM Container ####################################### @@ -29,6 +32,17 @@ services: links: - workspace +### HHVM Container ########################################## + + hhvm: + build: ./hhvm + volumes_from: + - volumes_source + expose: + - "9000" + links: + - workspace + ### MySQL Container ######################################### mysql: diff --git a/hhvm/Dockerfile b/hhvm/Dockerfile new file mode 100644 index 0000000..300bf29 --- /dev/null +++ b/hhvm/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:14.04 + +RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 +RUN apt-get update -y && apt-get install -y software-properties-common \ + && add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" \ + && apt-get update -y \ + && apt-get install -y hhvm \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /var/www/laravel + +ADD server.ini /etc/hhvm/server.ini + +RUN usermod -u 1000 www-data + +WORKDIR /var/www/laravel + +CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"] + +EXPOSE 9000 diff --git a/hhvm/server.ini b/hhvm/server.ini new file mode 100644 index 0000000..47d2017 --- /dev/null +++ b/hhvm/server.ini @@ -0,0 +1,20 @@ +; php options + +pid = /var/run/hhvm/pid + +; hhvm specific +hhvm.server.port = 9000 +hhvm.server.type = fastcgi +hhvm.server.default_document = index.php +hhvm.server.error_document404 = index.php +hhvm.server.upload.upload_max_file_size = 25M +hhvm.log.level = Error +hhvm.log.header = true +hhvm.log.access[default][file] = /var/log/hhvm/access.log +hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b" +hhvm.server.source_root=/var/www/laravel/public +hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc + +; Uncomment to log to files instead of STDOUT +;hhvm.log.use_log_file = true +;hhvm.log.file = /var/log/hhvm/error.log diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 495382f..5dec131 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -5,7 +5,9 @@ MAINTAINER Mahmoud Zalt ADD nginx.conf /etc/nginx/ ADD laravel.conf /etc/nginx/sites-available/ -RUN echo "upstream php-upstream { server php-fpm:9000; }" > /etc/nginx/conf.d/upstream.conf +ARG PHP_UPSTREAM + +RUN echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf RUN usermod -u 1000 www-data From f97f0b0d110a92042a71fea9ec94a3b039e27225 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 24 Jul 2016 07:39:25 +0300 Subject: [PATCH 30/75] update readme: include hhvm and new logo --- README.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index fd1d57d..f78cb54 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. >With LaraDock, use Docker first and learn about it later. -![](http://s18.postimg.org/fhykchl09/new_laradock_cover.png) +![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg)
## Contents @@ -74,10 +74,10 @@ docker-compose up nginx mysql redis ### Features -- Easy switch between PHP versions: 7.0 - 5.6 - 5.5 ... -- Choose your favorite database engine: MySQL - Postgres - Redis ... -- Run your own combination of software's: Memcached - MariaDB ... -- Every software runs on a separate container: PHP-FPM - NGINX ... +- Easy switch between PHP versions: 7.0, 5.6, 5.5... +- Choose your favorite database engine: MySQL, Postgres, MariaDB... +- Run your own combination of software's: Memcached, HHVM, Beanstalkd... +- Every software runs on a separate container: PHP-FPM, NGINX, PHP-CLI... - Easy to customize any container, with simple edit to the `dockerfile`. - All Images extends from an official base Image. (Trusted base Images). - Pre-configured Nginx for Laravel. @@ -86,6 +86,7 @@ docker-compose up nginx mysql redis - Clean and well structured Dockerfiles (`dockerfile`). - Latest version of the Docker Compose file (`docker-compose`). - Everything is visible and editable. +- More to come every week.. @@ -93,16 +94,17 @@ docker-compose up nginx mysql redis - PHP-FPM (7.0 - 5.6 - 5.5) - NGINX +- HHVM - MySQL - PostgreSQL - MariaDB -- Neo4j - MongoDB +- Neo4j - Redis - Memcached +- Caddy - Beanstalkd - Beanstalkd Console -- Caddy - Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano, cURL and much more) - Data *(Databases Data Container)* - Application *(Application Code Container)* @@ -169,7 +171,7 @@ What's better than a [**Demo Video**](https://www.youtube.com/watch?v=-DamFMczwD ## Installation -1 - Clone the `LaraDock` repository. +1 - Clone the `LaraDock` repository: **A)** If you already have a Laravel project, clone this repository on your `Laravel` root direcotry: @@ -208,7 +210,7 @@ docker-compose up -d nginx mysql You can select your own combination of container form this list: -`nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `caddy`, `workspace`, `data`, `php-fpm`, `application`. +`nginx`, `hhvm` ,`mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `caddy`, `workspace`, `data`, `php-fpm`, `application`. **Note**: `workspace`, `data`, `php-fpm` and `application` will run automatically in most of the cases. From 28a2d8e072a012871d9915c30f18154d872b4578 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 24 Jul 2016 23:11:33 +0300 Subject: [PATCH 31/75] delete the .env file making the central editing place is the docker-compose.yml file --- .env | 2 -- docker-compose.yml | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index 43554f3..0000000 --- a/.env +++ /dev/null @@ -1,2 +0,0 @@ -INSTALL_PRESTISSIMO=false -PHP_PROCESS_MANAGER=php-fpm diff --git a/docker-compose.yml b/docker-compose.yml index 4f225f2..cb37ea9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: build: context: ./nginx args: - - PHP_UPSTREAM=${PHP_PROCESS_MANAGER} + - PHP_UPSTREAM=php-fpm volumes_from: - volumes_source volumes: @@ -17,7 +17,7 @@ services: - "80:80" - "443:443" links: - - ${PHP_PROCESS_MANAGER} + - php-fpm ### PHP-FPM Container ####################################### From 23b0906cd794731cbc9235db4eb826a99b89625a Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Sun, 24 Jul 2016 23:25:31 +0300 Subject: [PATCH 32/75] delete the Dockerfile-55 file and rename Dockerfile-56 to Dockerfile-5 Since 5.5 and 5.6 dockerfiles are identical execept the base image php version. Will let the users switch the php 5.6 and 5.5 version from the Dockerfile-5 by changing one char in the first line. Removing this duplication will make contribution and maintance easier and faster. --- README.md | 40 ++++++++++++------- php-fpm/{Dockerfile-56 => Dockerfile-5} | 0 php-fpm/Dockerfile-55 | 52 ------------------------- 3 files changed, 27 insertions(+), 65 deletions(-) rename php-fpm/{Dockerfile-56 => Dockerfile-5} (100%) delete mode 100644 php-fpm/Dockerfile-55 diff --git a/README.md b/README.md index f78cb54..a7189c0 100644 --- a/README.md +++ b/README.md @@ -659,20 +659,18 @@ The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
-### Change the PHP-FPM Version +### Change the (PHP-FPM) Version By default **PHP-FPM 7.0** is running. >The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version. +#### A) Switch from PHP `7.0` to PHP `5.6` + 1 - Open the `docker-compose.yml`. 2 - Search for `Dockerfile-70` in the PHP container section. -3 - Change the version number. -
-Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`. - -Sample: +3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-5`, like this: ```txt php-fpm: @@ -681,19 +679,35 @@ php-fpm: dockerfile: Dockerfile-70 ``` -Supported Versions: - -- For (PHP 7.0.*) use `Dockerfile-70` -- For (PHP 5.6.*) use `Dockerfile-56` -- For (PHP 5.5.*) use `Dockerfile-55` - - 4 - Finally rebuild the container ```bash docker-compose build php ``` +#### B) Switch from PHP `7.0` or `5.6` to PHP `5.5` + +1 - Follow the steps of (Switch from PHP `7.0` to PHP `5.6`) except the last one "rebuilding container". + +2 - Open the `docker-compose.yml` again and make sure you are using `Dockerfile-5` like this: + +```txt +php-fpm: + build: + context: ./php-fpm + dockerfile: Dockerfile-5 +``` + +3 - Open `php-fpm/Dockerfile-5` file and on the first line replace the PHP version from (`FROM php:5.6-fpm`) to (`FROM php:5.5-fpm`). + +4 - Now you can rebuild the container + +```bash +docker-compose build php +``` + +
+ For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-5 similarity index 100% rename from php-fpm/Dockerfile-56 rename to php-fpm/Dockerfile-5 diff --git a/php-fpm/Dockerfile-55 b/php-fpm/Dockerfile-55 deleted file mode 100644 index 922cfad..0000000 --- a/php-fpm/Dockerfile-55 +++ /dev/null @@ -1,52 +0,0 @@ -FROM php:5.5-fpm - -MAINTAINER Mahmoud Zalt - -ADD ./laravel.ini /usr/local/etc/php/conf.d -ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ - -RUN apt-get update && apt-get install -y \ - libpq-dev \ - libmemcached-dev \ - curl \ - libjpeg-dev \ - libpng12-dev \ - libfreetype6-dev \ - libssl-dev \ - libmcrypt-dev \ - --no-install-recommends \ - && rm -r /var/lib/apt/lists/* - -# install mcrypt library -RUN docker-php-ext-install mcrypt - -# Install mongodb driver -RUN pecl install mongodb - -# configure gd library -RUN docker-php-ext-configure gd \ - --enable-gd-native-ttf \ - --with-jpeg-dir=/usr/lib \ - --with-freetype-dir=/usr/include/freetype2 - -# Install extensions using the helper script provided by the base image -RUN docker-php-ext-install \ - pdo_mysql \ - pdo_pgsql \ - gd - -# Install memcached -RUN pecl install memcached \ - && docker-php-ext-enable memcached - -# Install xdebug -RUN pecl install xdebug \ - && docker-php-ext-enable xdebug - -RUN usermod -u 1000 www-data - -WORKDIR /var/www/laravel - -CMD ["php-fpm"] - -EXPOSE 9000 From c8d446177179f5ba93e383b68c25ebc8bb08f061 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 01:30:19 +0300 Subject: [PATCH 33/75] Refactor the PHP 7 Dockerfile --- php-fpm/Dockerfile-70 | 73 ++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index b6df086..84dd53d 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -1,41 +1,60 @@ -FROM php:7.0-fpm +# +#-------------------------------------------------------------------------- +# Image Setup +#-------------------------------------------------------------------------- +# -MAINTAINER Mahmoud Zalt +FROM php:7.0-fpm ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update && apt-get install -y \ - libpq-dev \ - libmemcached-dev \ +RUN apt-get update + +# +#-------------------------------------------------------------------------- +# Software's Installation +#-------------------------------------------------------------------------- +# +# Installing tools and PHP extentions using "apt", "docker-php", "pecl", +# + +# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", +# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", +RUN apt-get install -y --no-install-recommends \ curl \ + libmemcached-dev \ + libpq-dev \ libjpeg-dev \ libpng12-dev \ libfreetype6-dev \ libssl-dev \ - libmcrypt-dev \ - --no-install-recommends \ - && rm -r /var/lib/apt/lists/* + libmcrypt-dev -# install mcrypt library +# Install the PHP mcrypt extention RUN docker-php-ext-install mcrypt -# Install mongodb driver +# Install the PHP pdo_mysql extention +RUN docker-php-ext-install pdo_mysql + +# Install the PHP pdo_pgsql extention +RUN docker-php-ext-install pdo_pgsql + +# Install the PHP gd library +RUN docker-php-ext-install gd \ + && docker-php-ext-configure gd \ + --enable-gd-native-ttf \ + --with-jpeg-dir=/usr/lib \ + --with-freetype-dir=/usr/include/freetype2 + +# Install the mongodb extention RUN pecl install mongodb -# configure gd library -RUN docker-php-ext-configure gd \ - --enable-gd-native-ttf \ - --with-jpeg-dir=/usr/lib \ - --with-freetype-dir=/usr/include/freetype2 +# Install the xdebug extention +RUN pecl install xdebug \ + && docker-php-ext-enable xdebug -# Install extensions using the helper script provided by the base image -RUN docker-php-ext-install \ - pdo_mysql \ - pdo_pgsql \ - gd - -# Install Memcached for php 7 +# Install the memcached extention RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ && mkdir -p memcached \ && tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ @@ -50,9 +69,13 @@ RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-m && rm /tmp/memcached.tar.gz \ && docker-php-ext-enable memcached -# Install xdebug -RUN pecl install xdebug \ - && docker-php-ext-enable xdebug +# +#-------------------------------------------------------------------------- +# Final Touch +#-------------------------------------------------------------------------- +# + +RUN rm -r /var/lib/apt/lists/* RUN usermod -u 1000 www-data From 67f92de4f095c68fdb17d083ea7c66fa98c0b2ef Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 02:14:19 +0300 Subject: [PATCH 34/75] Refactor the PHP 5 Dockerfile --- php-fpm/Dockerfile-5 | 71 ++++++++++++++++++++++++++++--------------- php-fpm/Dockerfile-70 | 2 ++ 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/php-fpm/Dockerfile-5 b/php-fpm/Dockerfile-5 index a725797..0b9eed7 100644 --- a/php-fpm/Dockerfile-5 +++ b/php-fpm/Dockerfile-5 @@ -1,3 +1,9 @@ +# +#-------------------------------------------------------------------------- +# Image Setup +#-------------------------------------------------------------------------- +# + FROM php:5.6-fpm MAINTAINER Mahmoud Zalt @@ -5,44 +11,59 @@ MAINTAINER Mahmoud Zalt ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update && apt-get install -y \ - libpq-dev \ - libmemcached-dev \ +RUN apt-get update + +# +#-------------------------------------------------------------------------- +# Software's Installation +#-------------------------------------------------------------------------- +# +# Installing tools and PHP extentions using "apt", "docker-php", "pecl", +# + +# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", +# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", +RUN apt-get install -y --no-install-recommends \ curl \ + libmemcached-dev \ + libpq-dev \ libjpeg-dev \ libpng12-dev \ libfreetype6-dev \ libssl-dev \ - libmcrypt-dev \ - --no-install-recommends \ - && rm -r /var/lib/apt/lists/* + libmcrypt-dev -# install mcrypt library +# Install the PHP mcrypt extention RUN docker-php-ext-install mcrypt -# Install mongodb driver +# Install the PHP pdo_mysql extention +RUN docker-php-ext-install pdo_mysql + +# Install the PHP pdo_pgsql extention +RUN docker-php-ext-install pdo_pgsql + +# Install the PHP gd library +RUN docker-php-ext-install gd \ + && docker-php-ext-configure gd \ + --enable-gd-native-ttf \ + --with-jpeg-dir=/usr/lib \ + --with-freetype-dir=/usr/include/freetype2 + +# Install the mongodb extention RUN pecl install mongodb -# configure gd library -RUN docker-php-ext-configure gd \ - --enable-gd-native-ttf \ - --with-jpeg-dir=/usr/lib \ - --with-freetype-dir=/usr/include/freetype2 - -# Install extensions using the helper script provided by the base image -RUN docker-php-ext-install \ - pdo_mysql \ - pdo_pgsql \ - gd - -# Install memcached -RUN pecl install memcached \ - && docker-php-ext-enable memcached - -# Install xdebug +# Install the xdebug extention RUN pecl install xdebug \ && docker-php-ext-enable xdebug +# +#-------------------------------------------------------------------------- +# Final Touch +#-------------------------------------------------------------------------- +# + +RUN rm -r /var/lib/apt/lists/* + RUN usermod -u 1000 www-data WORKDIR /var/www/laravel diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 84dd53d..df65646 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -6,6 +6,8 @@ FROM php:7.0-fpm +MAINTAINER Mahmoud Zalt + ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ From ca378ac7347a17ca06888a5ce41465810a6d9848 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 02:17:36 +0300 Subject: [PATCH 35/75] add libz-dev library to php containers --- php-fpm/Dockerfile-5 | 1 + php-fpm/Dockerfile-70 | 1 + 2 files changed, 2 insertions(+) diff --git a/php-fpm/Dockerfile-5 b/php-fpm/Dockerfile-5 index 0b9eed7..fb013db 100644 --- a/php-fpm/Dockerfile-5 +++ b/php-fpm/Dockerfile-5 @@ -26,6 +26,7 @@ RUN apt-get update RUN apt-get install -y --no-install-recommends \ curl \ libmemcached-dev \ + libz-dev \ libpq-dev \ libjpeg-dev \ libpng12-dev \ diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index df65646..c35f6f1 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -26,6 +26,7 @@ RUN apt-get update RUN apt-get install -y --no-install-recommends \ curl \ libmemcached-dev \ + libz-dev \ libpq-dev \ libjpeg-dev \ libpng12-dev \ From 2a02ed73e3373e9ad3ecfc6145a41f307ef77bda Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 02:48:38 +0300 Subject: [PATCH 36/75] Refactor the workspace container --- workspace/Dockerfile | 58 +++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 516344f..8998027 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1,3 +1,9 @@ +# +#-------------------------------------------------------------------------- +# Image Setup +#-------------------------------------------------------------------------- +# + FROM phusion/baseimage:latest MAINTAINER Mahmoud Zalt @@ -11,6 +17,12 @@ ENV LC_CTYPE=UTF-8 ENV LANG=en_US.UTF-8 ENV TERM xterm +# +#-------------------------------------------------------------------------- +# Software's Installation +#-------------------------------------------------------------------------- +# + # Install "software-properties-common" (for the "add-apt-repository") RUN apt-get update && apt-get install -y \ software-properties-common @@ -19,7 +31,7 @@ RUN apt-get update && apt-get install -y \ RUN add-apt-repository -y \ ppa:ondrej/php -# Install PHP-CLI 7, some PHP extentions and some useful Tools with APT +# Install "PHP-CLI 7", "PHP extentions", "useful Tools" RUN apt-get update && apt-get install -y --force-yes \ php7.0-cli \ php7.0-common \ @@ -50,38 +62,45 @@ RUN apt-get update && apt-get install -y --force-yes \ nano \ pkg-config -# Clean up, to free some space +# Clean up now, to free up some space RUN apt-get clean -# remove load xdebug extension (only load on phpunit command) -RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini - -# Add bin folder of composer to PATH. -RUN echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc - -# Install Composer +# Composer: Install composer and add its bin to the PATH. RUN curl -s http://getcomposer.org/installer | php \ + && echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc \ && mv composer.phar /usr/local/bin/composer -# Load xdebug Zend extension with phpunit command -RUN echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc +# Prestissimo: Install Prestissimo (A Composer parallel install plugin) +ARG INSTALL_PRESTISSIMO=false +RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \ + composer global require "hirak/prestissimo:^0.3"; \ + fi -# Install mongodb extension -RUN pecl install mongodb -RUN echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini +# MongoDB: Install the mongodb extension +RUN pecl install mongodb \ + && echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini -# Install nvm (Node Version Manager) +# XDebug: Load the xdebug extension only with phpunit commands +RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini \ + && echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc + +# NVM: Install nvm (A Node Version Manager) RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash - ENV NVM_DIR=/root/.nvm -# Install stable node +# Node: Install node RUN . ~/.nvm/nvm.sh \ && nvm install stable \ && nvm use stable \ && nvm alias stable \ && npm install -g gulp bower +# +#-------------------------------------------------------------------------- +# Final Touch +#-------------------------------------------------------------------------- +# + # Source the bash RUN . ~/.bashrc @@ -90,8 +109,3 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* WORKDIR /var/www/laravel -# Install optional software -ARG INSTALL_PRESTISSIMO=false -RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \ - composer global require "hirak/prestissimo:^0.3"; \ - fi From 419434020c544328dd9b01d70bbe0e0e152a335d Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 04:05:07 +0300 Subject: [PATCH 37/75] merge back apt-get update and install to keep them on the same layer --- php-fpm/Dockerfile-5 | 23 +++++++++++------------ php-fpm/Dockerfile-70 | 23 +++++++++++------------ 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/php-fpm/Dockerfile-5 b/php-fpm/Dockerfile-5 index fb013db..aa48b4f 100644 --- a/php-fpm/Dockerfile-5 +++ b/php-fpm/Dockerfile-5 @@ -11,8 +11,6 @@ MAINTAINER Mahmoud Zalt ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update - # #-------------------------------------------------------------------------- # Software's Installation @@ -23,16 +21,17 @@ RUN apt-get update # Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", # "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", -RUN apt-get install -y --no-install-recommends \ - curl \ - libmemcached-dev \ - libz-dev \ - libpq-dev \ - libjpeg-dev \ - libpng12-dev \ - libfreetype6-dev \ - libssl-dev \ - libmcrypt-dev +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libmemcached-dev \ + libz-dev \ + libpq-dev \ + libjpeg-dev \ + libpng12-dev \ + libfreetype6-dev \ + libssl-dev \ + libmcrypt-dev # Install the PHP mcrypt extention RUN docker-php-ext-install mcrypt diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index c35f6f1..2ff7b4e 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -11,8 +11,6 @@ MAINTAINER Mahmoud Zalt ADD ./laravel.ini /usr/local/etc/php/conf.d ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ -RUN apt-get update - # #-------------------------------------------------------------------------- # Software's Installation @@ -23,16 +21,17 @@ RUN apt-get update # Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", # "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", -RUN apt-get install -y --no-install-recommends \ - curl \ - libmemcached-dev \ - libz-dev \ - libpq-dev \ - libjpeg-dev \ - libpng12-dev \ - libfreetype6-dev \ - libssl-dev \ - libmcrypt-dev +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + curl \ + libmemcached-dev \ + libz-dev \ + libpq-dev \ + libjpeg-dev \ + libpng12-dev \ + libfreetype6-dev \ + libssl-dev \ + libmcrypt-dev # Install the PHP mcrypt extention RUN docker-php-ext-install mcrypt From e1dbb972f17e09659f111e85cd9979336245d9db Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 06:25:38 +0300 Subject: [PATCH 38/75] make Mongo, xDebug, Node, and prestissimo Installation Optional on the Workspace and PHP-FPM Containers + general refactoring --- README.md | 120 +++++++++++++++++++++++++++++++++++++++--- docker-compose.yml | 77 ++++++++++++++------------- php-fpm/Dockerfile-5 | 26 +++++---- php-fpm/Dockerfile-70 | 26 +++++---- workspace/Dockerfile | 92 +++++++++++++++++--------------- 5 files changed, 240 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index a7189c0..e4e9355 100644 --- a/README.md +++ b/README.md @@ -48,11 +48,13 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Install PHP Extensions](#Install-PHP-Extensions) - [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version) - [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version) + - [Install xDebug](#Install-xDebug) - [Misc](#Misc) - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) - [Install Prestissimo](#Install-Prestissimo) + - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) - [Help & Questions](#Help) @@ -577,14 +579,47 @@ composer require predis/predis:^1.0 ### Use Mongo -1 - First make sure you run the MongoDB Container (`mongo`) with the `docker-compose up` command. +1 - First install `mongo` in the Workspace and the PHP-FPM Containers: +
+a) open the `docker-compose.yml` file +
+b) search for the `INSTALL_MONGO` argument under the Workspace Container +
+c) set it to `true` +
+d) search for the `INSTALL_MONGO` argument under the PHP-FPM Container +
+e) set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_MONGO=true + ... + php-fpm: + build: + context: ./php-fpm + args: + - INSTALL_MONGO=true + ... +``` + +2 - Re-build the containers docker-compose build workspace php-fpm + + + +3 - Run the MongoDB Container (`mongo`) with the `docker-compose up` command. ```bash docker-compose up -d mongo ``` -2 - Add the MongoDB configurations to the `config/database.php` config file: +4 - Add the MongoDB configurations to the `config/database.php` config file: ```php 'connections' => [ @@ -606,21 +641,21 @@ docker-compose up -d mongo ], ``` -3 - Open your Laravel's `.env` file and update the following variables: +5 - Open your Laravel's `.env` file and update the following variables: - set the `DB_HOST` to your `Docker-IP`. - set the `DB_PORT` to `27017`. - set the `DB_DATABASE` to `database`. -4 - Finally make sure you have the `jenssegers/mongodb` package installed via Composer and its Service Provider is added. +6 - Finally make sure you have the `jenssegers/mongodb` package installed via Composer and its Service Provider is added. ```bash composer require jenssegers/mongodb ``` More details about this [here](https://github.com/jenssegers/laravel-mongodb#installation). -5 - Test it: +7 - Test it: - First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent). - Enter the Workspace Container `docker exec -it laradock_workspace_1 bash`. @@ -732,10 +767,42 @@ Right now you have to manually edit the `Dockerfile` or create a new one like it +
+ +### Install xDebug +1 - First install `xDebug` in the Workspace and the PHP-FPM Containers: +
+a) open the `docker-compose.yml` file +
+b) search for the `INSTALL_XDEBUG` argument under the Workspace Container +
+c) set it to `true` +
+d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container +
+e) set it to `true` +It should be like this: +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_XDEBUG=true + ... + php-fpm: + build: + context: ./php-fpm + args: + - INSTALL_XDEBUG=true + ... +``` +2 - Re-build the containers docker-compose build workspace php-fpm + +3 - Use it @@ -843,7 +910,48 @@ server_name laravel.dev; ### Install Prestissimo -[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. You can enable Prestissimo by setting `INSTALL_PRESTISSIMO=true` in the `docker-compose.yml` file. +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. + +To install Prestissimo in the Workspace container + +1 - Open the `docker-compose.yml` file + +2 - Search for the `INSTALL_PRESTISSIMO` argument under the Workspace Container and set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_PRESTISSIMO=true + ... +``` + +3 - Re-build the container docker-compose build workspace + + +### Install Node + NVM + +To install NVM and NodeJS in the Workspace container + +1 - Open the `docker-compose.yml` file + +2 - Search for the `INSTALL_NODE` argument under the Workspace Container and set it to `true` + +It should be like this: + +```yml + workspace: + build: + context: ./workspace + args: + - INSTALL_NODE=true + ... +``` + +3 - Re-build the container docker-compose build workspace
diff --git a/docker-compose.yml b/docker-compose.yml index cb37ea9..37b417f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,36 @@ version: '2' services: +### Workspace Utilities Container ########################### + + workspace: + build: + context: ./workspace + args: + - INSTALL_MONGO=false + - INSTALL_XDEBUG=false + - INSTALL_NODE=false + - INSTALL_PRESTISSIMO=false + volumes_from: + - volumes_source + tty: true + +### PHP-FPM Container ####################################### + + php-fpm: + build: + context: ./php-fpm + args: + - INSTALL_MONGO=false + - INSTALL_XDEBUG=false + dockerfile: Dockerfile-70 + volumes_from: + - volumes_source + expose: + - "9000" + links: + - workspace + ### Nginx Server Container ################################## nginx: @@ -19,19 +49,6 @@ services: links: - php-fpm -### PHP-FPM Container ####################################### - - php-fpm: - build: - context: ./php-fpm - dockerfile: Dockerfile-70 - volumes_from: - - volumes_source - expose: - - "9000" - links: - - workspace - ### HHVM Container ########################################## hhvm: @@ -144,16 +161,20 @@ services: links: - beanstalkd -### Workspace Utilities Container ########################### +### Caddy Server Container ################################## - workspace: - build: - context: ./workspace - args: - - INSTALL_PRESTISSIMO=false + caddy: + build: ./caddy volumes_from: - volumes_source - tty: true + ports: + - "80:80" + - "443:443" + - "2015:2015" + volumes: + - ./caddy/Caddyfile:/etc/Caddyfile + links: + - php-fpm ### Laravel Application Code Container ###################### @@ -174,21 +195,5 @@ services: - /var/lib/redis:/data - /var/lib/neo4j:/var/lib/neo4j/data - /var/lib/mongo:/data/db - -### Caddy Server Container ################################## -# Edit the Caddyfile if needed (./caddy/Caddyfile) - - caddy: - build: ./caddy - volumes_from: - - volumes_source - ports: - - "80:80" - - "443:443" - - "2015:2015" - volumes: - - ./caddy/Caddyfile:/etc/Caddyfile - links: - - php-fpm ### Add more Containers below ############################### diff --git a/php-fpm/Dockerfile-5 b/php-fpm/Dockerfile-5 index aa48b4f..d142a69 100644 --- a/php-fpm/Dockerfile-5 +++ b/php-fpm/Dockerfile-5 @@ -21,8 +21,8 @@ ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ # Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", # "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ curl \ libmemcached-dev \ libz-dev \ @@ -43,18 +43,26 @@ RUN docker-php-ext-install pdo_mysql RUN docker-php-ext-install pdo_pgsql # Install the PHP gd library -RUN docker-php-ext-install gd \ - && docker-php-ext-configure gd \ +RUN docker-php-ext-install gd && \ + docker-php-ext-configure gd \ --enable-gd-native-ttf \ --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 -# Install the mongodb extention -RUN pecl install mongodb +ARG INSTALL_MONGO=true +ENV INSTALL_MONGO ${INSTALL_MONGO} +RUN if [ ${INSTALL_MONGO} = true ]; then \ + # Install the mongodb extention + pecl install mongodb \ +;fi -# Install the xdebug extention -RUN pecl install xdebug \ - && docker-php-ext-enable xdebug +ARG INSTALL_XDEBUG=true +ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} +RUN if [ ${INSTALL_XDEBUG} = true ]; then \ + # Install the xdebug extention + pecl install xdebug && \ + docker-php-ext-enable xdebug \ +;fi # #-------------------------------------------------------------------------- diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 2ff7b4e..f7a4e56 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -21,8 +21,8 @@ ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ # Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", # "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ curl \ libmemcached-dev \ libz-dev \ @@ -43,18 +43,26 @@ RUN docker-php-ext-install pdo_mysql RUN docker-php-ext-install pdo_pgsql # Install the PHP gd library -RUN docker-php-ext-install gd \ - && docker-php-ext-configure gd \ +RUN docker-php-ext-install gd && \ + docker-php-ext-configure gd \ --enable-gd-native-ttf \ --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 -# Install the mongodb extention -RUN pecl install mongodb +ARG INSTALL_MONGO=true +ENV INSTALL_MONGO ${INSTALL_MONGO} +RUN if [ ${INSTALL_MONGO} = true ]; then \ + # Install the mongodb extention + pecl install mongodb \ +;fi -# Install the xdebug extention -RUN pecl install xdebug \ - && docker-php-ext-enable xdebug +ARG INSTALL_XDEBUG=true +ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} +RUN if [ ${INSTALL_XDEBUG} = true ]; then \ + # Install the xdebug extention + pecl install xdebug && \ + docker-php-ext-enable xdebug \ +;fi # Install the memcached extention RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 8998027..62ba840 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -17,22 +17,19 @@ ENV LC_CTYPE=UTF-8 ENV LANG=en_US.UTF-8 ENV TERM xterm +# Add the "PHP 7" ppa +RUN apt-get install -y software-properties-common && \ + add-apt-repository -y ppa:ondrej/php + # #-------------------------------------------------------------------------- # Software's Installation #-------------------------------------------------------------------------- # -# Install "software-properties-common" (for the "add-apt-repository") -RUN apt-get update && apt-get install -y \ - software-properties-common - -# Add the "PHP 7" ppa -RUN add-apt-repository -y \ - ppa:ondrej/php - -# Install "PHP-CLI 7", "PHP extentions", "useful Tools" -RUN apt-get update && apt-get install -y --force-yes \ +# Install "PHP Extentions", "libraries", "Software's" +RUN apt-get update && \ + apt-get install -y --force-yes \ php7.0-cli \ php7.0-common \ php7.0-curl \ @@ -47,53 +44,65 @@ RUN apt-get update && apt-get install -y --force-yes \ php7.0-zip \ php7.0-memcached \ php7.0-gd \ - php7.0-xdebug \ + pkg-config \ php-dev \ libcurl4-openssl-dev \ libedit-dev \ libssl-dev \ libxml2-dev \ xz-utils \ - sqlite3 \ libsqlite3-dev \ + sqlite3 \ git \ curl \ vim \ nano \ - pkg-config - -# Clean up now, to free up some space -RUN apt-get clean + && apt-get clean # Composer: Install composer and add its bin to the PATH. -RUN curl -s http://getcomposer.org/installer | php \ - && echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc \ - && mv composer.phar /usr/local/bin/composer +RUN curl -s http://getcomposer.org/installer | php && \ + echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc && \ + mv composer.phar /usr/local/bin/composer -# Prestissimo: Install Prestissimo (A Composer parallel install plugin) -ARG INSTALL_PRESTISSIMO=false -RUN if [ "$INSTALL_PRESTISSIMO" = true ] ; then \ - composer global require "hirak/prestissimo:^0.3"; \ - fi +ARG INSTALL_PRESTISSIMO=true +ENV INSTALL_PRESTISSIMO ${INSTALL_PRESTISSIMO} +RUN if [ ${INSTALL_PRESTISSIMO} = true ]; then \ + # Prestissimo: Install Prestissimo (A Composer parallel install plugin) + composer global require "hirak/prestissimo:^0.3" \ +;fi -# MongoDB: Install the mongodb extension -RUN pecl install mongodb \ - && echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini +ARG INSTALL_MONGO=true +ENV INSTALL_MONGO ${INSTALL_MONGO} +RUN if [ ${INSTALL_MONGO} = true ]; then \ + # MongoDB: Install the mongodb extension + pecl install mongodb && \ + echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \ +;fi -# XDebug: Load the xdebug extension only with phpunit commands -RUN sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini \ - && echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc +ARG INSTALL_XDEBUG=true +ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} +RUN if [ ${INSTALL_XDEBUG} = true ]; then \ + # XDebug: Load the xdebug extension only with phpunit commands + apt-get install -y --force-yes php7.0-xdebug && \ + sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ + echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ +;fi -# NVM: Install nvm (A Node Version Manager) -RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash -ENV NVM_DIR=/root/.nvm - -# Node: Install node -RUN . ~/.nvm/nvm.sh \ - && nvm install stable \ - && nvm use stable \ - && nvm alias stable \ - && npm install -g gulp bower +ARG INSTALL_NODE=true +ENV INSTALL_NODE ${INSTALL_NODE} +RUN if [ ${INSTALL_NODE} = true ]; then \ + # Node: Install nvm (A Node Version Manager) and use it to install NodeJS + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash \ +;fi +ENV if [ ${INSTALL_NODE} = true ]; then \ + # I had to split this condifiton link this because when I get it inside the above if statment is refuses to work! + NVM_DIR=/root/.nvm \ + RUN . ~/.nvm/nvm.sh && \ + nvm install stable && \ + nvm use stable && \ + nvm alias stable && \ + npm install -g gulp bower \ +;fi # #-------------------------------------------------------------------------- @@ -105,7 +114,8 @@ RUN . ~/.nvm/nvm.sh \ RUN . ~/.bashrc # Clean up -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* WORKDIR /var/www/laravel From 062b7466f67b914f8ad62da4c7fc1c705de37b9e Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 07:00:50 +0300 Subject: [PATCH 39/75] add composer.json to install global composer dependencies --- README.md | 52 ++++++++++++++++++++++++++++++----------- docker-compose.yml | 2 +- workspace/Dockerfile | 51 ++++++++++++++++++++++++++++++---------- workspace/composer.json | 5 ++++ 4 files changed, 83 insertions(+), 27 deletions(-) create mode 100644 workspace/composer.json diff --git a/README.md b/README.md index e4e9355..4a66adc 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) + - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) - [Install Prestissimo](#Install-Prestissimo) - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) @@ -608,7 +609,7 @@ It should be like this: ... ``` -2 - Re-build the containers docker-compose build workspace php-fpm +2 - Re-build the containers `docker-compose build workspace php-fpm` @@ -800,9 +801,7 @@ It should be like this: ... ``` -2 - Re-build the containers docker-compose build workspace php-fpm - -3 - Use it +2 - Re-build the containers `docker-compose build workspace php-fpm` @@ -906,17 +905,16 @@ server_name laravel.dev; ``` +
- -### Install Prestissimo + +### Enable Global Composer Build Install -[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. +To enable Running Global Composer Install during the Build: -To install Prestissimo in the Workspace container +1 - open the `docker-compose.yml` file -1 - Open the `docker-compose.yml` file - -2 - Search for the `INSTALL_PRESTISSIMO` argument under the Workspace Container and set it to `true` +2 - search for the `COMPOSER_GLOBAL_INSTALL` argument under the Workspace Container and set it to `true` It should be like this: @@ -925,11 +923,37 @@ It should be like this: build: context: ./workspace args: - - INSTALL_PRESTISSIMO=true + - COMPOSER_GLOBAL_INSTALL=true ... ``` +3 - now add your dependencies to `workspace/composer.json` + +4 - rebuild the Workspace Container `docker-compose build workspace` + + + + +
+ +### Install Prestissimo + +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. + +1 - Enable Running Global Composer Install during the Build: + +Click on this [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) and do steps 1 and 2 only then continue here. + +2 - Add prestissimo as requirement in Composer: + +a - now open the `workspace/composer.json` file + +b - add `"hirak/prestissimo": "^0.3"` as requirement + +c - rebuild the Workspace Container `docker-compose build workspace` + + + -3 - Re-build the container docker-compose build workspace ### Install Node + NVM @@ -951,7 +975,7 @@ It should be like this: ... ``` -3 - Re-build the container docker-compose build workspace +3 - Re-build the container `docker-compose build workspace`
diff --git a/docker-compose.yml b/docker-compose.yml index 37b417f..ab3dc0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: - INSTALL_MONGO=false - INSTALL_XDEBUG=false - INSTALL_NODE=false - - INSTALL_PRESTISSIMO=false + - COMPOSER_GLOBAL_INSTALL=false volumes_from: - volumes_source tty: true diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 62ba840..c9af47d 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -59,44 +59,71 @@ RUN apt-get update && \ nano \ && apt-get clean -# Composer: Install composer and add its bin to the PATH. +##################################### +# Composer: +##################################### + +# Install composer and add its bin to the PATH. RUN curl -s http://getcomposer.org/installer | php && \ echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc && \ mv composer.phar /usr/local/bin/composer -ARG INSTALL_PRESTISSIMO=true -ENV INSTALL_PRESTISSIMO ${INSTALL_PRESTISSIMO} +# Add the composer.json +ADD ./composer.json /root/.composer/composer.json + +# Check if global install need to be runned +ARG COMPOSER_GLOBAL_INSTALL=true +ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} RUN if [ ${INSTALL_PRESTISSIMO} = true ]; then \ - # Prestissimo: Install Prestissimo (A Composer parallel install plugin) - composer global require "hirak/prestissimo:^0.3" \ + # run the install + composer global install \ ;fi + +##################################### +# MongoDB: +##################################### + +# Check if Mongo needs to be installed ARG INSTALL_MONGO=true ENV INSTALL_MONGO ${INSTALL_MONGO} RUN if [ ${INSTALL_MONGO} = true ]; then \ - # MongoDB: Install the mongodb extension + # Install the mongodb extension pecl install mongodb && \ - echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \ + echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \ ;fi +##################################### +# xDebug: +##################################### + +# Check if xDebug needs to be installed ARG INSTALL_XDEBUG=true ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ - # XDebug: Load the xdebug extension only with phpunit commands + # Load the xdebug extension only with phpunit commands apt-get install -y --force-yes php7.0-xdebug && \ - sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ - echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ + sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ + echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ ;fi +##################################### +# Node / NVM: +##################################### + +# Check if NVM needs to be installed ARG INSTALL_NODE=true ENV INSTALL_NODE ${INSTALL_NODE} RUN if [ ${INSTALL_NODE} = true ]; then \ - # Node: Install nvm (A Node Version Manager) and use it to install NodeJS + # Install nvm (A Node Version Manager) curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash \ ;fi +# Again check if NVM needs to be installed +# I had to split this condifiton link this because when I get it inside the above if statment is refuses to work! ENV if [ ${INSTALL_NODE} = true ]; then \ - # I had to split this condifiton link this because when I get it inside the above if statment is refuses to work! + # Set the ENV NVM_DIR=/root/.nvm \ + # Install NodeJS with NVM RUN . ~/.nvm/nvm.sh && \ nvm install stable && \ nvm use stable && \ diff --git a/workspace/composer.json b/workspace/composer.json new file mode 100644 index 0000000..0c1370f --- /dev/null +++ b/workspace/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + + } +} From d5ffc04034f6ef54cf272db6c4b8dd36f46cc050 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 07:05:24 +0300 Subject: [PATCH 40/75] remove data and application containers from the readme --- README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4a66adc..b9af785 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,6 @@ docker-compose up nginx mysql redis - Easy to customize any container, with simple edit to the `dockerfile`. - All Images extends from an official base Image. (Trusted base Images). - Pre-configured Nginx for Laravel. -- Data container, to keep Data safe and accessible. - Easy to apply configurations inside containers. - Clean and well structured Dockerfiles (`dockerfile`). - Latest version of the Docker Compose file (`docker-compose`). @@ -109,8 +108,6 @@ docker-compose up nginx mysql redis - Beanstalkd - Beanstalkd Console - Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano, cURL and much more) -- Data *(Databases Data Container)* -- Application *(Application Code Container)* >If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) @@ -213,10 +210,10 @@ docker-compose up -d nginx mysql You can select your own combination of container form this list: -`nginx`, `hhvm` ,`mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `caddy`, `workspace`, `data`, `php-fpm`, `application`. +`nginx`, `hhvm` ,`mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `caddy`, `workspace`, `php-fpm`. -**Note**: `workspace`, `data`, `php-fpm` and `application` will run automatically in most of the cases. +**Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. From 11f7cfe7291c3e67b35e03bc638002b78cd6aea7 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 07:15:26 +0300 Subject: [PATCH 41/75] fix an error missed COMPOSER_GLOBAL_INSTALL --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index c9af47d..f03af40 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -74,7 +74,7 @@ ADD ./composer.json /root/.composer/composer.json # Check if global install need to be runned ARG COMPOSER_GLOBAL_INSTALL=true ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} -RUN if [ ${INSTALL_PRESTISSIMO} = true ]; then \ +RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ # run the install composer global install \ ;fi From 462b5685eb3437b2ef60784644dae007c9bfcada Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 07:27:15 +0300 Subject: [PATCH 42/75] add some comments sections to the php dockerfiles --- php-fpm/Dockerfile-5 | 13 +++++++++++++ php-fpm/Dockerfile-70 | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/php-fpm/Dockerfile-5 b/php-fpm/Dockerfile-5 index d142a69..62d6d83 100644 --- a/php-fpm/Dockerfile-5 +++ b/php-fpm/Dockerfile-5 @@ -42,6 +42,10 @@ RUN docker-php-ext-install pdo_mysql # Install the PHP pdo_pgsql extention RUN docker-php-ext-install pdo_pgsql +##################################### +# gd: +##################################### + # Install the PHP gd library RUN docker-php-ext-install gd && \ docker-php-ext-configure gd \ @@ -49,6 +53,10 @@ RUN docker-php-ext-install gd && \ --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 +##################################### +# MongoDB: +##################################### + ARG INSTALL_MONGO=true ENV INSTALL_MONGO ${INSTALL_MONGO} RUN if [ ${INSTALL_MONGO} = true ]; then \ @@ -56,6 +64,10 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ pecl install mongodb \ ;fi +##################################### +# xDebug: +##################################### + ARG INSTALL_XDEBUG=true ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ @@ -64,6 +76,7 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ docker-php-ext-enable xdebug \ ;fi + # #-------------------------------------------------------------------------- # Final Touch diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index f7a4e56..5ffeccb 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -42,6 +42,10 @@ RUN docker-php-ext-install pdo_mysql # Install the PHP pdo_pgsql extention RUN docker-php-ext-install pdo_pgsql +##################################### +# gd: +##################################### + # Install the PHP gd library RUN docker-php-ext-install gd && \ docker-php-ext-configure gd \ @@ -49,6 +53,10 @@ RUN docker-php-ext-install gd && \ --with-jpeg-dir=/usr/lib \ --with-freetype-dir=/usr/include/freetype2 +##################################### +# MongoDB: +##################################### + ARG INSTALL_MONGO=true ENV INSTALL_MONGO ${INSTALL_MONGO} RUN if [ ${INSTALL_MONGO} = true ]; then \ @@ -56,6 +64,10 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ pecl install mongodb \ ;fi +##################################### +# xDebug: +##################################### + ARG INSTALL_XDEBUG=true ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} RUN if [ ${INSTALL_XDEBUG} = true ]; then \ @@ -64,6 +76,10 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ docker-php-ext-enable xdebug \ ;fi +##################################### +# Memcached: +##################################### + # Install the memcached extention RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ && mkdir -p memcached \ From d58ef06907fd79693d84a52dd99ca6645c9b5308 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 07:31:31 +0300 Subject: [PATCH 43/75] refactoring some containers --- beanstalkd-console/Dockerfile | 8 +++++--- caddy/Dockerfile | 7 +++++-- hhvm/Dockerfile | 15 ++++++++------- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/beanstalkd-console/Dockerfile b/beanstalkd-console/Dockerfile index f42178d..5bebdd5 100644 --- a/beanstalkd-console/Dockerfile +++ b/beanstalkd-console/Dockerfile @@ -7,9 +7,11 @@ RUN apt-get update && apt-get install -y curl RUN curl -sL https://github.com/ptrofimov/beanstalk_console/archive/master.tar.gz | tar xvz -C /tmp RUN mv /tmp/beanstalk_console-master /source -RUN apt-get remove --purge -y curl && apt-get autoclean && apt-get clean -RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt-get remove --purge -y curl && + apt-get autoclean && + apt-get clean && + rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* EXPOSE 2080 -CMD bash -c 'BEANSTALK_SERVERS=$BEANSTALKD_PORT_11300_TCP_ADDR:11300 php -S 0.0.0.0:2080 -t /source/public' \ No newline at end of file +CMD bash -c 'BEANSTALK_SERVERS=$BEANSTALKD_PORT_11300_TCP_ADDR:11300 php -S 0.0.0.0:2080 -t /source/public' diff --git a/caddy/Dockerfile b/caddy/Dockerfile index 0694237..9bf05ec 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -1,11 +1,12 @@ FROM alpine:3.4 + MAINTAINER Eric Pfeiffer LABEL caddy_version="0.9.0" architecture="amd64" RUN apk update \ - && apk upgrade \ - && apk add tar curl + && apk upgrade \ + && apk add tar curl RUN curl --silent --show-error --fail --location \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ @@ -16,7 +17,9 @@ RUN curl --silent --show-error --fail --location \ && /usr/bin/caddy -version EXPOSE 80 443 2015 + WORKDIR /var/www/laravel/public ENTRYPOINT ["caddy"] + CMD ["-conf", "/etc/Caddyfile"] diff --git a/hhvm/Dockerfile b/hhvm/Dockerfile index 300bf29..ed787c2 100644 --- a/hhvm/Dockerfile +++ b/hhvm/Dockerfile @@ -1,12 +1,13 @@ FROM ubuntu:14.04 -RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 -RUN apt-get update -y && apt-get install -y software-properties-common \ - && add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" \ - && apt-get update -y \ - && apt-get install -y hhvm \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 + +RUN apt-get install -y software-properties-common \ + && add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" \ + && apt-get update -y \ + && apt-get install -y hhvm \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* RUN mkdir -p /var/www/laravel From c60cb9ab402a3f3aecc756cabd7469d9f230e1c9 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Mon, 25 Jul 2016 07:47:17 +0300 Subject: [PATCH 44/75] return `apt-get update` to HHVM --- README.md | 4 ++-- hhvm/Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b9af785..62f0c23 100644 --- a/README.md +++ b/README.md @@ -907,7 +907,7 @@ server_name laravel.dev; ### Enable Global Composer Build Install -To enable Running Global Composer Install during the Build: +Enabling Global Composer Install during the build for the container allows you to get your composer requirements installed and available in the container after the build is done. 1 - open the `docker-compose.yml` file @@ -951,7 +951,7 @@ c - rebuild the Workspace Container `docker-compose build workspace` - +
### Install Node + NVM diff --git a/hhvm/Dockerfile b/hhvm/Dockerfile index ed787c2..a9569c9 100644 --- a/hhvm/Dockerfile +++ b/hhvm/Dockerfile @@ -2,7 +2,8 @@ FROM ubuntu:14.04 RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 -RUN apt-get install -y software-properties-common \ +RUN apt-get update -y \ + && apt-get install -y software-properties-common \ && add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main" \ && apt-get update -y \ && apt-get install -y hhvm \ From ed8e2410078343542d36675ef46acd96832274e8 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 26 Jul 2016 11:19:31 -0500 Subject: [PATCH 45/75] use nginx:alpine as base. --- nginx/Dockerfile | 9 ++++----- nginx/nginx.conf | 5 +---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index 5dec131..f05232d 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -1,15 +1,14 @@ -FROM nginx:latest +FROM nginx:alpine MAINTAINER Mahmoud Zalt ADD nginx.conf /etc/nginx/ -ADD laravel.conf /etc/nginx/sites-available/ +ADD laravel.conf /etc/nginx/conf.d/laravel.conf ARG PHP_UPSTREAM -RUN echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf - -RUN usermod -u 1000 www-data +RUN rm /etc/nginx/conf.d/default.conf \ + && echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf CMD ["nginx"] diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 3e8dadd..a05c838 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,6 +1,6 @@ -user www-data; worker_processes 4; pid /run/nginx.pid; +daemon off; events { worker_connections 2048; @@ -23,8 +23,5 @@ http { gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-available/*; open_file_cache max=100; } - -daemon off; From e6cf30e7bae0962573ba341b45ce042605e114d9 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 26 Jul 2016 12:41:52 -0500 Subject: [PATCH 46/75] re-added www-data user for nginx. log to stdout. --- nginx/Dockerfile | 8 ++++++-- nginx/nginx.conf | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index f05232d..f9bfc1b 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -5,9 +5,13 @@ MAINTAINER Mahmoud Zalt ADD nginx.conf /etc/nginx/ ADD laravel.conf /etc/nginx/conf.d/laravel.conf -ARG PHP_UPSTREAM +ARG PHP_UPSTREAM=php-fpm -RUN rm /etc/nginx/conf.d/default.conf \ +RUN apk update \ + && apk upgrade \ + && apk add --no-cache bash \ + && adduser -D -H -u 1000 -s /bin/bash www-data \ + && rm /etc/nginx/conf.d/default.conf \ && echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf CMD ["nginx"] diff --git a/nginx/nginx.conf b/nginx/nginx.conf index a05c838..1b56608 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,3 +1,4 @@ +user www-data; worker_processes 4; pid /run/nginx.pid; daemon off; @@ -18,8 +19,8 @@ http { client_max_body_size 20M; include /etc/nginx/mime.types; default_type application/octet-stream; - access_log on; - error_log on; + access_log /dev/stdout; + error_log /dev/stderr; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; From e4f6cec53694563d14f80404d788b5e3bd152684 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 26 Jul 2016 12:53:26 -0500 Subject: [PATCH 47/75] fix nginx to actually log to files. --- nginx/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 1b56608..cc7fa68 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -19,8 +19,8 @@ http { client_max_body_size 20M; include /etc/nginx/mime.types; default_type application/octet-stream; - access_log /dev/stdout; - error_log /dev/stderr; + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; From 97057f259c08b1e16d04a7d0cec01a95894e9bb7 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Tue, 26 Jul 2016 17:16:25 -0500 Subject: [PATCH 48/75] Update Caddyfile fixes 404 errors for files in the public folder, such as css or js files. --- caddy/Caddyfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index d8f6a5d..5052db3 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -1,12 +1,17 @@ # Docs: https://caddyserver.com/docs/caddyfile 0.0.0.0:80 -fastcgi / php-fpm:9000 php +root /var/www/laravel/public +fastcgi / php-fpm:9000 php { + index index.php +} rewrite { + r .* + ext / to /index.php?{query} } browse log stdout -errors stdout +errors stderr # Uncomment to enable TLS (HTTPS) # Change the first list to listen on port 443 when enabling TLS #tls self_signed From 5bb3d3b6a8cdabfbeba44f7484503870f4c8a11f Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 27 Jul 2016 03:57:32 +0300 Subject: [PATCH 49/75] rename PHP-FPM Dockerfile5 to Dockerfile56 --- README.md | 8 ++++---- php-fpm/{Dockerfile-5 => Dockerfile-56} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename php-fpm/{Dockerfile-5 => Dockerfile-56} (100%) diff --git a/README.md b/README.md index 62f0c23..715f969 100644 --- a/README.md +++ b/README.md @@ -703,7 +703,7 @@ By default **PHP-FPM 7.0** is running. 2 - Search for `Dockerfile-70` in the PHP container section. -3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-5`, like this: +3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this: ```txt php-fpm: @@ -722,16 +722,16 @@ docker-compose build php 1 - Follow the steps of (Switch from PHP `7.0` to PHP `5.6`) except the last one "rebuilding container". -2 - Open the `docker-compose.yml` again and make sure you are using `Dockerfile-5` like this: +2 - Open the `docker-compose.yml` again and make sure you are using `Dockerfile-56` like this: ```txt php-fpm: build: context: ./php-fpm - dockerfile: Dockerfile-5 + dockerfile: Dockerfile-56 ``` -3 - Open `php-fpm/Dockerfile-5` file and on the first line replace the PHP version from (`FROM php:5.6-fpm`) to (`FROM php:5.5-fpm`). +3 - Open `php-fpm/Dockerfile-56` file and on the first line replace the PHP version from (`FROM php:5.6-fpm`) to (`FROM php:5.5-fpm`). 4 - Now you can rebuild the container diff --git a/php-fpm/Dockerfile-5 b/php-fpm/Dockerfile-56 similarity index 100% rename from php-fpm/Dockerfile-5 rename to php-fpm/Dockerfile-56 From 2d1c1586f5c4b6e03c0a92b8dbb4a58d3b2569ed Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 27 Jul 2016 04:22:20 +0300 Subject: [PATCH 50/75] use laradock workspace base image to speed up the build time --- workspace/Dockerfile | 115 +++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 75 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index f03af40..a5af2f4 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -4,82 +4,49 @@ #-------------------------------------------------------------------------- # -FROM phusion/baseimage:latest +FROM laradock/workspace:1.0.0 MAINTAINER Mahmoud Zalt -RUN DEBIAN_FRONTEND=noninteractive -RUN locale-gen en_US.UTF-8 - -ENV LANGUAGE=en_US.UTF-8 -ENV LC_ALL=en_US.UTF-8 -ENV LC_CTYPE=UTF-8 -ENV LANG=en_US.UTF-8 -ENV TERM xterm - -# Add the "PHP 7" ppa -RUN apt-get install -y software-properties-common && \ - add-apt-repository -y ppa:ondrej/php +# +#-------------------------------------------------------------------------- +# Mandatory Software's Installation +#-------------------------------------------------------------------------- +# +# Mandatory Software's such as ("php7.0-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). +# # #-------------------------------------------------------------------------- -# Software's Installation +# Optional Software's Installation #-------------------------------------------------------------------------- # - -# Install "PHP Extentions", "libraries", "Software's" -RUN apt-get update && \ - apt-get install -y --force-yes \ - php7.0-cli \ - php7.0-common \ - php7.0-curl \ - php7.0-json \ - php7.0-xml \ - php7.0-mbstring \ - php7.0-mcrypt \ - php7.0-mysql \ - php7.0-pgsql \ - php7.0-sqlite \ - php7.0-sqlite3 \ - php7.0-zip \ - php7.0-memcached \ - php7.0-gd \ - pkg-config \ - php-dev \ - libcurl4-openssl-dev \ - libedit-dev \ - libssl-dev \ - libxml2-dev \ - xz-utils \ - libsqlite3-dev \ - sqlite3 \ - git \ - curl \ - vim \ - nano \ - && apt-get clean +# Optional Software's will only be installed if you set them to `true` +# in the `docker-compose.yml` before the build. +# +# - INSTALL_XDEBUG= false +# - INSTALL_MONGO= false +# - COMPOSER_GLOBAL_INSTALL= false +# - INSTALL_NODE= false +# ##################################### -# Composer: +# xDebug: ##################################### -# Install composer and add its bin to the PATH. -RUN curl -s http://getcomposer.org/installer | php && \ - echo "export PATH=${PATH}:/var/www/laravel/vendor/bin" >> ~/.bashrc && \ - mv composer.phar /usr/local/bin/composer - -# Add the composer.json -ADD ./composer.json /root/.composer/composer.json - -# Check if global install need to be runned -ARG COMPOSER_GLOBAL_INSTALL=true -ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} -RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ - # run the install - composer global install \ +# Check if xDebug needs to be installed +ARG INSTALL_XDEBUG=true +ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} +RUN if [ ${INSTALL_XDEBUG} = true ]; then \ + # Load the xdebug extension only with phpunit commands + apt-get install -y --force-yes php7.0-xdebug && \ + sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ + echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ ;fi - ##################################### # MongoDB: ##################################### @@ -94,17 +61,18 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ ;fi ##################################### -# xDebug: +# Composer: ##################################### -# Check if xDebug needs to be installed -ARG INSTALL_XDEBUG=true -ENV INSTALL_XDEBUG ${INSTALL_XDEBUG} -RUN if [ ${INSTALL_XDEBUG} = true ]; then \ - # Load the xdebug extension only with phpunit commands - apt-get install -y --force-yes php7.0-xdebug && \ - sed -i 's/^/;/g' /etc/php/7.0/cli/conf.d/20-xdebug.ini && \ - echo "alias phpunit='php -dzend_extension=xdebug.so /var/www/laravel/vendor/bin/phpunit'" >> ~/.bashrc \ +# Add the composer.json +ADD ./composer.json /root/.composer/composer.json + +# Check if global install need to be runned +ARG COMPOSER_GLOBAL_INSTALL=true +ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} +RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ + # run the install + composer global install \ ;fi ##################################### @@ -137,12 +105,9 @@ ENV if [ ${INSTALL_NODE} = true ]; then \ #-------------------------------------------------------------------------- # -# Source the bash -RUN . ~/.bashrc - # Clean up RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +# Set default work directory WORKDIR /var/www/laravel - From c792a780ee1cb37281b06a19845635e739f16621 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 27 Jul 2016 04:22:31 +0300 Subject: [PATCH 51/75] use laradock php-fpm base images to speed up the build time --- php-fpm/Dockerfile-56 | 80 ++++++++++++++----------------------- php-fpm/Dockerfile-70 | 92 +++++++++++++------------------------------ 2 files changed, 57 insertions(+), 115 deletions(-) diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 62d6d83..e5a3843 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -4,65 +4,32 @@ #-------------------------------------------------------------------------- # -FROM php:5.6-fpm +FROM laradock/php-fpm:5.6 MAINTAINER Mahmoud Zalt -ADD ./laravel.ini /usr/local/etc/php/conf.d -ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ +# +#-------------------------------------------------------------------------- +# Mandatory Software's Installation +#-------------------------------------------------------------------------- +# +# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....) +# are installed on the base image 'laradock/php-fpm' image. If you want +# to add more Software's or remove existing one, you need to edit the +# base image (https://github.com/LaraDock/php-fpm). +# # #-------------------------------------------------------------------------- -# Software's Installation +# Optional Software's Installation #-------------------------------------------------------------------------- # -# Installing tools and PHP extentions using "apt", "docker-php", "pecl", +# Optional Software's will only be installed if you set them to `true` +# in the `docker-compose.yml` before the build. +# +# - INSTALL_XDEBUG= false +# - INSTALL_MONGO= false # - -# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", -# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - curl \ - libmemcached-dev \ - libz-dev \ - libpq-dev \ - libjpeg-dev \ - libpng12-dev \ - libfreetype6-dev \ - libssl-dev \ - libmcrypt-dev - -# Install the PHP mcrypt extention -RUN docker-php-ext-install mcrypt - -# Install the PHP pdo_mysql extention -RUN docker-php-ext-install pdo_mysql - -# Install the PHP pdo_pgsql extention -RUN docker-php-ext-install pdo_pgsql - -##################################### -# gd: -##################################### - -# Install the PHP gd library -RUN docker-php-ext-install gd && \ - docker-php-ext-configure gd \ - --enable-gd-native-ttf \ - --with-jpeg-dir=/usr/lib \ - --with-freetype-dir=/usr/include/freetype2 - -##################################### -# MongoDB: -##################################### - -ARG INSTALL_MONGO=true -ENV INSTALL_MONGO ${INSTALL_MONGO} -RUN if [ ${INSTALL_MONGO} = true ]; then \ - # Install the mongodb extention - pecl install mongodb \ -;fi ##################################### # xDebug: @@ -76,6 +43,16 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ docker-php-ext-enable xdebug \ ;fi +##################################### +# MongoDB: +##################################### + +ARG INSTALL_MONGO=true +ENV INSTALL_MONGO ${INSTALL_MONGO} +RUN if [ ${INSTALL_MONGO} = true ]; then \ + # Install the mongodb extention + pecl install mongodb \ +;fi # #-------------------------------------------------------------------------- @@ -83,6 +60,9 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ #-------------------------------------------------------------------------- # +ADD ./laravel.ini /usr/local/etc/php/conf.d +ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ + RUN rm -r /var/lib/apt/lists/* RUN usermod -u 1000 www-data diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 5ffeccb..0429843 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -4,65 +4,32 @@ #-------------------------------------------------------------------------- # -FROM php:7.0-fpm +FROM laradock/php-fpm:7.0 MAINTAINER Mahmoud Zalt -ADD ./laravel.ini /usr/local/etc/php/conf.d -ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ +# +#-------------------------------------------------------------------------- +# Mandatory Software's Installation +#-------------------------------------------------------------------------- +# +# Mandatory Software's such as ("mcrypt", "pdo_mysql", "libssl-dev", ....) +# are installed on the base image 'laradock/php-fpm' image. If you want +# to add more Software's or remove existing one, you need to edit the +# base image (https://github.com/LaraDock/php-fpm). +# # #-------------------------------------------------------------------------- -# Software's Installation +# Optional Software's Installation #-------------------------------------------------------------------------- # -# Installing tools and PHP extentions using "apt", "docker-php", "pecl", +# Optional Software's will only be installed if you set them to `true` +# in the `docker-compose.yml` before the build. +# +# - INSTALL_XDEBUG= false +# - INSTALL_MONGO= false # - -# Install "curl", "libmemcached-dev", "libpq-dev", "libjpeg-dev", -# "libpng12-dev", "libfreetype6-dev", "libssl-dev", "libmcrypt-dev", -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - curl \ - libmemcached-dev \ - libz-dev \ - libpq-dev \ - libjpeg-dev \ - libpng12-dev \ - libfreetype6-dev \ - libssl-dev \ - libmcrypt-dev - -# Install the PHP mcrypt extention -RUN docker-php-ext-install mcrypt - -# Install the PHP pdo_mysql extention -RUN docker-php-ext-install pdo_mysql - -# Install the PHP pdo_pgsql extention -RUN docker-php-ext-install pdo_pgsql - -##################################### -# gd: -##################################### - -# Install the PHP gd library -RUN docker-php-ext-install gd && \ - docker-php-ext-configure gd \ - --enable-gd-native-ttf \ - --with-jpeg-dir=/usr/lib \ - --with-freetype-dir=/usr/include/freetype2 - -##################################### -# MongoDB: -##################################### - -ARG INSTALL_MONGO=true -ENV INSTALL_MONGO ${INSTALL_MONGO} -RUN if [ ${INSTALL_MONGO} = true ]; then \ - # Install the mongodb extention - pecl install mongodb \ -;fi ##################################### # xDebug: @@ -77,23 +44,15 @@ RUN if [ ${INSTALL_XDEBUG} = true ]; then \ ;fi ##################################### -# Memcached: +# MongoDB: ##################################### -# Install the memcached extention -RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ - && mkdir -p memcached \ - && tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ - && ( \ - cd memcached \ - && phpize \ - && ./configure \ - && make -j$(nproc) \ - && make install \ - ) \ - && rm -r memcached \ - && rm /tmp/memcached.tar.gz \ - && docker-php-ext-enable memcached +ARG INSTALL_MONGO=true +ENV INSTALL_MONGO ${INSTALL_MONGO} +RUN if [ ${INSTALL_MONGO} = true ]; then \ + # Install the mongodb extention + pecl install mongodb \ +;fi # #-------------------------------------------------------------------------- @@ -101,6 +60,9 @@ RUN curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-m #-------------------------------------------------------------------------- # +ADD ./laravel.ini /usr/local/etc/php/conf.d +ADD ./laravel.pool.conf /usr/local/etc/php-fpm.d/ + RUN rm -r /var/lib/apt/lists/* RUN usermod -u 1000 www-data From e65f0dcebaf8244e7fd8aa2b1e42bc3aaedfdda6 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 27 Jul 2016 04:34:45 +0300 Subject: [PATCH 52/75] add docker build version to the base image --- php-fpm/Dockerfile-56 | 2 +- php-fpm/Dockerfile-70 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index e5a3843..65b1bb7 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -4,7 +4,7 @@ #-------------------------------------------------------------------------- # -FROM laradock/php-fpm:5.6 +FROM laradock/php-fpm:5.6--1.0 MAINTAINER Mahmoud Zalt diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 0429843..1a994ef 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -4,7 +4,7 @@ #-------------------------------------------------------------------------- # -FROM laradock/php-fpm:7.0 +FROM laradock/php-fpm:7.0--1.0 MAINTAINER Mahmoud Zalt From 10af217349102a9afbb6f17cf890f5cdacc7d720 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 27 Jul 2016 04:39:54 +0300 Subject: [PATCH 53/75] update workspace build version --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index a5af2f4..db96f48 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -4,7 +4,7 @@ #-------------------------------------------------------------------------- # -FROM laradock/workspace:1.0.0 +FROM laradock/workspace:1.0 MAINTAINER Mahmoud Zalt From 2ba3060564bfc0ba8126bd3837b13d26ee5d08fc Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 27 Jul 2016 05:44:36 +0300 Subject: [PATCH 54/75] update the readme: switch to php 5.5 --- README.md | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 715f969..83c8388 100644 --- a/README.md +++ b/README.md @@ -88,13 +88,14 @@ docker-compose up nginx mysql redis - Clean and well structured Dockerfiles (`dockerfile`). - Latest version of the Docker Compose file (`docker-compose`). - Everything is visible and editable. +- Fast Images Builds. - More to come every week.. ### Supported Containers -- PHP-FPM (7.0 - 5.6 - 5.5) +- PHP-FPM - NGINX - HHVM - MySQL @@ -107,7 +108,7 @@ docker-compose up nginx mysql redis - Caddy - Beanstalkd - Beanstalkd Console -- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, SQLite, Vim, Nano, cURL and much more) +- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...) >If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) @@ -718,30 +719,27 @@ php-fpm: docker-compose build php ``` +> For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). + + #### B) Switch from PHP `7.0` or `5.6` to PHP `5.5` -1 - Follow the steps of (Switch from PHP `7.0` to PHP `5.6`) except the last one "rebuilding container". +We do not natively support PHP 5.5 anymore, but you can get it in few steps: -2 - Open the `docker-compose.yml` again and make sure you are using `Dockerfile-56` like this: +1 - Clone `https://github.com/LaraDock/php-fpm`. -```txt -php-fpm: - build: - context: ./php-fpm - dockerfile: Dockerfile-56 -``` +3 - Rename `Dockerfile-56` to `Dockerfile-55`. -3 - Open `php-fpm/Dockerfile-56` file and on the first line replace the PHP version from (`FROM php:5.6-fpm`) to (`FROM php:5.5-fpm`). +3 - Edit the file `FROM php:5.6-fpm` to `FROM php:5.5-fpm`. -4 - Now you can rebuild the container +4 - Build an image from `Dockerfile-55`. + +5 - Open the `docker-compose.yml` file. + +6 - Point `php-fpm` to your `Dockerfile-55` file. -```bash -docker-compose build php -``` -
-For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/). From 17e252a4366bff3c8be0c08af86523dcf4ac5fdc Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Wed, 27 Jul 2016 02:43:38 -0500 Subject: [PATCH 55/75] add non-root user for workspace container. --- docker-compose.yml | 4 +++- workspace/Dockerfile | 30 ++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ab3dc0f..9d4f556 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,8 +10,10 @@ services: args: - INSTALL_MONGO=false - INSTALL_XDEBUG=false - - INSTALL_NODE=false + - INSTALL_NODE=true - COMPOSER_GLOBAL_INSTALL=false + - PUID=1000 + - PGID=1000 volumes_from: - volumes_source tty: true diff --git a/workspace/Dockerfile b/workspace/Dockerfile index db96f48..aac9bd6 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -60,12 +60,25 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \ ;fi +##################################### +# Non-Root User: +##################################### + +# Add a non-root user to prevent files being created with root permissions on host machine. +ARG PUID=1000 +ARG PGID=1000 +RUN groupadd -g $PGID laradock && \ + useradd -u $PUID -g laradock -m laradock + +# Now switch to our laradock user for the rest of user setup +USER laradock + ##################################### # Composer: ##################################### # Add the composer.json -ADD ./composer.json /root/.composer/composer.json +ADD ./composer.json /home/laradock/.composer/composer.json # Check if global install need to be runned ARG COMPOSER_GLOBAL_INSTALL=true @@ -84,13 +97,13 @@ ARG INSTALL_NODE=true ENV INSTALL_NODE ${INSTALL_NODE} RUN if [ ${INSTALL_NODE} = true ]; then \ # Install nvm (A Node Version Manager) - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash \ ;fi # Again check if NVM needs to be installed -# I had to split this condifiton link this because when I get it inside the above if statment is refuses to work! +# I had to split this condition link this because when I get it inside the above if statement is refuses to work! ENV if [ ${INSTALL_NODE} = true ]; then \ # Set the ENV - NVM_DIR=/root/.nvm \ + NVM_DIR=/home/laradock/.nvm \ # Install NodeJS with NVM RUN . ~/.nvm/nvm.sh && \ nvm install stable && \ @@ -99,6 +112,14 @@ ENV if [ ${INSTALL_NODE} = true ]; then \ npm install -g gulp bower \ ;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 + # #-------------------------------------------------------------------------- # Final Touch @@ -106,6 +127,7 @@ ENV if [ ${INSTALL_NODE} = true ]; then \ # # Clean up +USER root RUN apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* From dd9855d4116c2fc6c3c404ef246a975ab1a445a5 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Wed, 27 Jul 2016 02:49:43 -0500 Subject: [PATCH 56/75] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 83c8388..f8cad06 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,8 @@ You can select your own combination of container form this list: docker exec -it {Workspace-Container-Name} bash ``` Replace `{Workspace-Container-Name}` with your Workspace container name. +
+Add `--user=laradock` to have files created as your host's user. (don't forget to change the PUID (User id) and PGID (group id) variables in docker-compose.yml).
To find the containers names type `docker-compose ps`. @@ -657,7 +659,7 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins 7 - Test it: - First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent). -- Enter the Workspace Container `docker exec -it laradock_workspace_1 bash`. +- Enter the Workspace Container `docker exec -it --user=laradock laradock_workspace_1 bash`. - Migrate the Database `php artisan migrate`. From 20adc9ca1360370354413bbb21378d8d6c8b4030 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Wed, 27 Jul 2016 02:56:48 -0500 Subject: [PATCH 57/75] accidentally forgot to set INSTALL_NODE back to false. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9d4f556..27e7e8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,7 @@ services: args: - INSTALL_MONGO=false - INSTALL_XDEBUG=false - - INSTALL_NODE=true + - INSTALL_NODE=false - COMPOSER_GLOBAL_INSTALL=false - PUID=1000 - PGID=1000 From 5e0e120950d5c4da8458f2ae2633e55283a5bb3c Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Wed, 27 Jul 2016 19:35:58 -0500 Subject: [PATCH 58/75] add apache2 container. --- README.md | 18 +++++++++--------- apache2/Dockerfile | 17 +++++++++++++++++ docker-compose.yml | 17 +++++++++++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 apache2/Dockerfile diff --git a/README.md b/README.md index f8cad06..7042923 100644 --- a/README.md +++ b/README.md @@ -211,7 +211,7 @@ docker-compose up -d nginx mysql You can select your own combination of container form this list: -`nginx`, `hhvm` ,`mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `caddy`, `workspace`, `php-fpm`. +`apache2`, `caddy`, `nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`. **Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. @@ -580,15 +580,15 @@ composer require predis/predis:^1.0 ### Use Mongo -1 - First install `mongo` in the Workspace and the PHP-FPM Containers: +1 - First install `mongo` in the Workspace and the PHP-FPM Containers:
a) open the `docker-compose.yml` file
-b) search for the `INSTALL_MONGO` argument under the Workspace Container +b) search for the `INSTALL_MONGO` argument under the Workspace Container
c) set it to `true`
-d) search for the `INSTALL_MONGO` argument under the PHP-FPM Container +d) search for the `INSTALL_MONGO` argument under the PHP-FPM Container
e) set it to `true` @@ -769,15 +769,15 @@ Right now you have to manually edit the `Dockerfile` or create a new one like it ### Install xDebug -1 - First install `xDebug` in the Workspace and the PHP-FPM Containers: +1 - First install `xDebug` in the Workspace and the PHP-FPM Containers:
a) open the `docker-compose.yml` file
-b) search for the `INSTALL_XDEBUG` argument under the Workspace Container +b) search for the `INSTALL_XDEBUG` argument under the Workspace Container
c) set it to `true`
-d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container +d) search for the `INSTALL_XDEBUG` argument under the PHP-FPM Container
e) set it to `true` @@ -934,7 +934,7 @@ It should be like this: ### Install Prestissimo -[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. +[Prestissimo](https://github.com/hirak/prestissimo) is a plugin for composer which enables parallel install functionality. 1 - Enable Running Global Composer Install during the Build: @@ -1006,7 +1006,7 @@ This little project was built by one man who has a full time job and many respon ## Help & Questions -Join the chat room on [Gitter](https://gitter.im/LaraDock/laradock) and get help and support from the community. +Join the chat room on [Gitter](https://gitter.im/LaraDock/laradock) and get help and support from the community. You can as well can open an [issue](https://github.com/laradock/laradock/issues) on Github (will be labeled as Question) and discuss it with people on [Gitter](https://gitter.im/LaraDock/laradock). diff --git a/apache2/Dockerfile b/apache2/Dockerfile new file mode 100644 index 0000000..7ee9b85 --- /dev/null +++ b/apache2/Dockerfile @@ -0,0 +1,17 @@ +FROM webdevops/apache:ubuntu-16.04 + +MAINTAINER Eric Pfeiffer + +ARG PHP_SOCKET="php-fpm:9000" + +ENV WEB_PHP_SOCKET=$PHP_SOCKET + +ENV WEB_DOCUMENT_ROOT=/var/www/laravel/public + +EXPOSE 80 443 + +WORKDIR /var/www/laravel/public + +ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"] + +CMD ["supervisord"] diff --git a/docker-compose.yml b/docker-compose.yml index 27e7e8b..86072f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -51,6 +51,23 @@ services: links: - php-fpm +### Apache Server Container ################################## + + apache2: + build: + context: ./apache2 + args: + - PHP_SOCKET="php-fpm:9000" + volumes_from: + - volumes_source + volumes: + - ./logs/apache2:/var/log/apache2 + ports: + - "80:80" + - "443:443" + links: + - php-fpm + ### HHVM Container ########################################## hhvm: From c5ac8d1ada5ce0470faa1804b8eb411352946b37 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 28 Jul 2016 08:08:41 +0300 Subject: [PATCH 59/75] add apache to the readme --- README.md | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 7042923..6b605a6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Intro](#Intro) - [Features](#features) - - [Supported Containers](#Supported-Containers) + - [Supported Software's](#Supported-Containers) - [What is Docker](#what-is-docker) - [What is Laravel](#what-is-laravel) - [Why Docker not Vagrant](#why-docker-not-vagrant) @@ -93,25 +93,31 @@ docker-compose up nginx mysql redis -### Supported Containers +### Supported Software's (Containers) -- PHP-FPM -- NGINX -- HHVM -- MySQL -- PostgreSQL -- MariaDB -- MongoDB -- Neo4j -- Redis -- Memcached -- Caddy -- Beanstalkd -- Beanstalkd Console -- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...) +- **Database Engines:** + - MySQL + - PostgreSQL + - MariaDB + - MongoDB + - Neo4j +- **Cache Engines:** + - Redis + - Memcached +- **PHP Servers:** + - NGINX + - Apache2 + - Caddy +- **PHP Compilers:** + - PHP-FPM + - HHVM +- **Message Queueing Systems:** + - Beanstalkd (+ Beanstalkd Console) +- **Tools:** + - Workspace (PHP7-CLI, Composer, Git, Node, Gulp, SQLite, Vim, Nano, cURL...) ->If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :) +>If you can't find your Software, build it yourself and add it to this list. Contributions are welcomed :) @@ -209,9 +215,9 @@ git clone https://github.com/LaraDock/laradock.git docker-compose up -d nginx mysql ``` -You can select your own combination of container form this list: +You can select your own combination of Containers form the list below: -`apache2`, `caddy`, `nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`. +`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `workspace`. **Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. From b7d38ef7dda5ca9f9da66a24d48d43c9073a1a76 Mon Sep 17 00:00:00 2001 From: Maelle Date: Thu, 28 Jul 2016 11:49:42 +0200 Subject: [PATCH 60/75] parameter data in the path --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 86072f9..2f9de80 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -207,12 +207,12 @@ services: volumes_data: build: ./volumes/data volumes: - - /var/lib/mysql:/var/lib/mysql - - /var/lib/postgres:/var/lib/postgres - - /var/lib/mariadb:/var/lib/mariadb - - /var/lib/memcached:/var/lib/memcached - - /var/lib/redis:/data - - /var/lib/neo4j:/var/lib/neo4j/data - - /var/lib/mongo:/data/db + - ./data/mysql:/var/lib/mysql + - ./data/postgres:/var/lib/postgres + - ./data/mariadb:/var/lib/mariadb + - ./data/memcached:/var/lib/memcached + - ./data/redis:/data + - ./data/neo4j:/var/lib/neo4j/data + - ./data/mongo:/data/db ### Add more Containers below ############################### From 42d551dead5353af2ddc7c9e50d0cd90d722fa50 Mon Sep 17 00:00:00 2001 From: Jack Fletcher Date: Fri, 29 Jul 2016 09:59:12 +0100 Subject: [PATCH 61/75] Fix user permissions issue when installing Composer in the workspace container --- workspace/Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index aac9bd6..8fdd23e 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -78,9 +78,14 @@ USER laradock ##################################### # Add the composer.json -ADD ./composer.json /home/laradock/.composer/composer.json +COPY ./composer.json /home/laradock/.composer/composer.json -# Check if global install need to be runned +# Make sure that ~/.composer belongs to laradock +USER root +RUN chown -R laradock:laradock /home/laradock/.composer +USER laradock + +# Check if global install need to be ran ARG COMPOSER_GLOBAL_INSTALL=true ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ From 2f156edafdcc282809e24f10c64c16d650f89c98 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 29 Jul 2016 13:19:44 +0300 Subject: [PATCH 62/75] Fix syntax error in the beanstalkd-console dockerfile --- beanstalkd-console/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/beanstalkd-console/Dockerfile b/beanstalkd-console/Dockerfile index 5bebdd5..b07f1e3 100644 --- a/beanstalkd-console/Dockerfile +++ b/beanstalkd-console/Dockerfile @@ -7,9 +7,9 @@ RUN apt-get update && apt-get install -y curl RUN curl -sL https://github.com/ptrofimov/beanstalk_console/archive/master.tar.gz | tar xvz -C /tmp RUN mv /tmp/beanstalk_console-master /source -RUN apt-get remove --purge -y curl && - apt-get autoclean && - apt-get clean && +RUN apt-get remove --purge -y curl && \ + apt-get autoclean && \ + apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* EXPOSE 2080 From afac432b2fc5e1c888b3ee82feac4c76d53c3278 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 29 Jul 2016 13:52:16 +0300 Subject: [PATCH 63/75] upgrade readme to docker native --- README.md | 205 ++++++++++++++++++++++-------------------------------- 1 file changed, 85 insertions(+), 120 deletions(-) diff --git a/README.md b/README.md index 6b605a6..6ac4c18 100644 --- a/README.md +++ b/README.md @@ -50,13 +50,12 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version) - [Install xDebug](#Install-xDebug) - [Misc](#Misc) - - [Run a Docker Virtual Host](#Run-Docker-Virtual-Host) - - [Find your Docker IP Address](#Find-Docker-IP-Address) - [Use custom Domain](#Use-custom-Domain) - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) - [Install Prestissimo](#Install-Prestissimo) - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) + - [Upgrading Docker](#upgrading) - [Help & Questions](#Help) @@ -71,7 +70,7 @@ It contains pre-packaged Docker Images that provides you a wonderful development **Usage Overview:** Run `NGINX`, `MySQL` and `Redis`. ```shell -docker-compose up nginx mysql redis +docker-compose up nginx mysql redis ``` @@ -159,20 +158,27 @@ Running a virtual Container is much faster than running a full virtual Machine. - -## Requirements -| Linux | Windows & MAC | -|--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------| -| [Laravel](https://laravel.com/docs/master/installation) | [Laravel](https://laravel.com/docs/master/installation) | -| [Git](https://git-scm.com/downloads) | [Git](https://git-scm.com/downloads) | -| [Docker Engine](https://docs.docker.com/engine/installation/linux/ubuntulinux) | [Docker Toolbox](https://www.docker.com/toolbox) OR [Native Docker](https://beta.docker.com/) | -| [Docker Compose](https://docs.docker.com/compose/install) | | ## Demo Video -What's better than a [**Demo Video**](https://www.youtube.com/watch?v=-DamFMczwDA) :) +What's better than a **Demo Video**: + +- LaraDock v4.0 (Coming soon..) +- LaraDock [v2.2](https://www.youtube.com/watch?v=-DamFMczwDA) +- LaraDock [v0.3](https://www.youtube.com/watch?v=jGkyO6Is_aI) +- LaraDock [v0.1](https://www.youtube.com/watch?v=3YQsHe6oF80) + + + + +## Requirements + +- [Git](https://git-scm.com/downloads) +- [Docker](https://www.docker.com/products/docker/) + + ## Installation @@ -199,13 +205,17 @@ git clone https://github.com/LaraDock/laradock.git ## Usage -1 - For **Windows & MAC** users only: If you are not using the native Docker-Engine `Beta`, make sure you have a running Docker Virtual Host on your machine. -[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host) -(**Linux** users don't need a Virtual Host, so skip this step). +>**Note:** +
+>LaraDock version 4 and above is customized only for **Docker Native** (For Mac/Windows). +
+>LaraDock version 3 and below is customized only for **Docker Toolbox** (VirtualBox VM). If you are still using the "Docker Toolbox" you might need to check the branch `LaraDock-ToolBox`. + +
-2 - Run some Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).* +1 - Run Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).* @@ -224,39 +234,34 @@ You can select your own combination of Containers form the list below: - -
-3 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...). +2 - Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...). ```bash -docker exec -it {Workspace-Container-Name} bash +docker-compose exec workspace bash ``` -Replace `{Workspace-Container-Name}` with your Workspace container name.
-Add `--user=laradock` to have files created as your host's user. (don't forget to change the PUID (User id) and PGID (group id) variables in docker-compose.yml). -
-To find the containers names type `docker-compose ps`. +Add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user. (you can change the PUID (User id) and PGID (group id) variables from the `docker-compose.yml`).
-4 - Edit the Laravel configurations. +3 - Edit the Laravel configurations. If you don't have a Laravel project installed yet, see [How to Install Laravel in a Docker Container](#Install-Laravel). -Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`: +Open your Laravel's `.env` file and set the `DB_HOST` to your `mysql`: ```env -DB_HOST=xxx.xxx.xxx.xxx +DB_HOST=mysql ``` -[How to find my Docker IP Address?](#Find-Docker-IP-Address) +
-5 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`). +4 - Open your browser and visit your localhost address (`http://localhost/`). @@ -270,8 +275,6 @@ If you need a special support. Contact me, more details in the [Help & Questions ## Documentation -**Note:** this documentation doesn't cover the Docker Beta *(Native Docker on MAC and Windows)*. However, the commands are very similar. We are planning to cover the Docker Beta soon. - ### [Docker] @@ -335,8 +338,15 @@ docker-compose down 2 - enter any container using: ```bash -docker exec -it {container-name} bash +docker-composer exec {container-name} bash ``` + +*Example: enter MySQL container* + +```bash +docker-compose exec mysql bash +``` + 3 - to exit a container, type `exit`. @@ -388,10 +398,7 @@ example for `mysql` it will be `mysql/Dockerfile`. ```bash docker-compose build mysql ``` - -*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.* - - +More info on Containers rebuilding [here](#Build-Re-build-Containers). @@ -415,6 +422,7 @@ Optionally you can specify which container to rebuild (instead of rebuilding all docker-compose build {container-name} ``` +You might use the `--no-cache` option if you want full rebuilding (`docker-compose build --no-cache {container-name}`). @@ -492,6 +500,8 @@ Since the new Laravel application is in the `my-cool-app` folder, we need to rep cd my-cool-app ``` +5 - Go back to the laraDock installation steps to see how to edit the `.env` file. +
@@ -515,9 +525,12 @@ docker-compose ps 3 - Enter the Workspace container: ```bash -docker exec -it {workspace-container-name} bash +docker-compose exec workspace bash ``` +Add `--user=laradock` (example `docker-compose exec --user=laradock workspace bash`) to have files created as your host's user. + + 4 - Run anything you want :) ```bash @@ -540,19 +553,19 @@ phpunit docker-compose up -d redis ``` -2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to your `Docker-IP` instead of the default `127.0.0.1` IP. +2 - Open your Laravel's `.env` file and set the `REDIS_HOST` to `redis` ```env -REDIS_HOST=xxx.xxx.xxx.xxx +REDIS_HOST=redis ``` -If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the default `127.0.0.1` IP with your `Docker-IP` for Redis like this: +If you don't find the `REDIS_HOST` variable in your `.env` file. Go to the database config file `config/database.php` and replace the default `127.0.0.1` IP with `redis` for Redis like this: ```php 'redis' => [ 'cluster' => false, 'default' => [ - 'host' => 'xxx.xxx.xxx.xxx', + 'host' => 'redis', 'port' => 6379, 'database' => 0, ], @@ -650,7 +663,7 @@ docker-compose up -d mongo 5 - Open your Laravel's `.env` file and update the following variables: -- set the `DB_HOST` to your `Docker-IP`. +- set the `DB_HOST` to your `mongo`. - set the `DB_PORT` to `27017`. - set the `DB_DATABASE` to `database`. @@ -665,7 +678,7 @@ More details about this [here](https://github.com/jenssegers/laravel-mongodb#ins 7 - Test it: - First let your Models extend from the Mongo Eloquent Model. Check the [documentation](https://github.com/jenssegers/laravel-mongodb#eloquent). -- Enter the Workspace Container `docker exec -it --user=laradock laradock_workspace_1 bash`. +- Enter the Workspace Container. - Migrate the Database `php artisan migrate`. @@ -813,92 +826,19 @@ It should be like this: ### [Misc] - - - - -### Run a Docker Virtual Host - -These steps are only for **Windows & MAC** users *(Linux users don't need a virtual host)*: - -1 - Run the default Host: - -```bash -docker-machine start default -``` - -* If the host "default" does not exist, create one using the command below, else skip it: - -* ```bash - docker-machine create -d virtualbox default - ``` - -2 - Run this command to configure your shell: - -```bash -eval $(docker-machine env) -``` - - - - - - - -
- -### Find your Docker IP Address - -**On Windows & MAC:** - -Run this command in your terminal: - -```bash -docker-machine ip default -``` -If your Host name is different then `default`, you have to specify it (`docker-machine ip my-host`). - -*(The default IP is 192.168.99.100)* - -
- -> **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*. - -
-**On Linux:** - -Run this command in your terminal: - -```shell -ifconfig docker0 | grep 'inet' | cut -d: -f2 | awk '{ print $1}' | head -n1 -``` - -*(The default IP is 172.17.0.1)* - - -
### Use custom Domain (instead of the Docker IP) -Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`. +Assuming your custom domain is `laravel.dev` -1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following: +1 - Open your `/etc/hosts` file and map your localhost address `127.0.0.1` to the `laravel.dev` domain, by adding the following: ```bash -xxx.xxx.xxx.xxx laravel.dev +127.0.0.1 laravel.dev ``` -2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`. -
-Example: - -```env -DB_HOST=xxx.xxx.xxx.xxx -``` - -3 - Open your browser and visit `{http://laravel.dev}` - +2 - Open your browser and visit `{http://laravel.dev}` Optionally you can define the server name in the nginx config file, like this: @@ -980,6 +920,8 @@ It should be like this: 3 - Re-build the container `docker-compose build workspace` + +
### Debugging @@ -1003,6 +945,29 @@ Use `http://127.0.0.1` (or [your Docker IP](#Find-Docker-IP-Address)) instead of Make sure the ports for the services that you are trying to run (80, 3306, etc.) are not being used already by other programs, such as a built in `apache`/`httpd` service or other development tools you have installed. + + +
+ +### Upgrading Docker + +#### From Docker Toolbox (VirtualBox) to Docker for Mac/Windows (Native) + +1. Stop the docker vm `docker-machine stop {default}` +2. Install Docker for [Mac](https://docs.docker.com/docker-for-mac/) or [Windows](https://docs.docker.com/docker-for-windows/). +3. Upgrade LaraDock to `v4.*.*`. +4. Use LaraDock as you used to do: `docker-compose up -d nginx mysql`. + +**Note:** If you face any problem with the last step above: rebuild all your containers "Warnning Containers Data might be lost!" +`docker-compose build --no-cache` + + + + + + + +
## Contributing From 605c191717e5f2898c42e88f4b0d5029a46ba951 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 29 Jul 2016 14:53:25 +0300 Subject: [PATCH 64/75] add more info for upgrading docker in the reamdme --- README.md | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6ac4c18..07aa5da 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Install Prestissimo](#Install-Prestissimo) - [Install Node + NVM](#Install-Node) - [Debugging](#debugging) - - [Upgrading Docker](#upgrading) + - [Upgrading LaraDock](#upgrading-laradock) - [Help & Questions](#Help) @@ -205,15 +205,19 @@ git clone https://github.com/LaraDock/laradock.git ## Usage ->**Note:** +**Read Before starting:** + +If you are using **Docker Toolbox** (VM), do one of the following: + +- Upgrade to Docker [Native](https://www.docker.com/products/docker) for Mac/Windows (Recommended). Check out [Upgrading Laradock](#upgrading-laradock) +- Use LaraDock v3.* (Visit the `LaraDock-ToolBox` [Branch](https://github.com/LaraDock/laradock/tree/LaraDock-ToolBox)). + + +If you are using **Docker Native** (For Mac/Windows) or even for Linux, continue this documentation normally since LaraDock v4 and above is just for that. + + +
->LaraDock version 4 and above is customized only for **Docker Native** (For Mac/Windows). -
->LaraDock version 3 and below is customized only for **Docker Toolbox** (VirtualBox VM). If you are still using the "Docker Toolbox" you might need to check the branch `LaraDock-ToolBox`. - - - -
1 - Run Containers: *(Make sure you are in the `laradock` folder before running the `docker-compose` commands).* @@ -948,19 +952,20 @@ Make sure the ports for the services that you are trying to run (80, 3306, etc.)
- -### Upgrading Docker + +### Upgrading LaraDock -#### From Docker Toolbox (VirtualBox) to Docker for Mac/Windows (Native) + +Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requires upgrading LaraDock from v3.* to v4.*: 1. Stop the docker vm `docker-machine stop {default}` 2. Install Docker for [Mac](https://docs.docker.com/docker-for-mac/) or [Windows](https://docs.docker.com/docker-for-windows/). -3. Upgrade LaraDock to `v4.*.*`. +3. Upgrade LaraDock to `v4.*.*` (`git pull origin master`) 4. Use LaraDock as you used to do: `docker-compose up -d nginx mysql`. -**Note:** If you face any problem with the last step above: rebuild all your containers "Warnning Containers Data might be lost!" +**Note:** If you face any problem with the last step above: rebuild all your containers `docker-compose build --no-cache` - +"Warnning Containers Data might be lost!" From f36f9ef6ec35e0fc75b842d3344fd9a69801f2a4 Mon Sep 17 00:00:00 2001 From: Eric Pfeiffer Date: Fri, 29 Jul 2016 10:16:06 -0500 Subject: [PATCH 65/75] minimize user switching in build. --- workspace/Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 8fdd23e..ab79cc3 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -70,9 +70,6 @@ ARG PGID=1000 RUN groupadd -g $PGID laradock && \ useradd -u $PUID -g laradock -m laradock -# Now switch to our laradock user for the rest of user setup -USER laradock - ##################################### # Composer: ##################################### @@ -81,7 +78,6 @@ USER laradock COPY ./composer.json /home/laradock/.composer/composer.json # Make sure that ~/.composer belongs to laradock -USER root RUN chown -R laradock:laradock /home/laradock/.composer USER laradock From 48a6c06ebb718c6611ad7d242f7acd1a34b3a9b1 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Fri, 29 Jul 2016 18:39:24 +0300 Subject: [PATCH 66/75] update readme: better overview --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 07aa5da..d9388dd 100644 --- a/README.md +++ b/README.md @@ -67,11 +67,20 @@ LaraDock strives to make the development experience easier. It contains pre-packaged Docker Images that provides you a wonderful development environment without requiring you to install PHP, NGINX, MySQL, REDIS, and any other software on your local machine. -**Usage Overview:** Run `NGINX`, `MySQL` and `Redis`. +**Usage Overview:** + +Let's see how easy it is to install `NGINX`, `PHP`, `Composer`, `MySQL` and `Redis`. Then run `Laravel`. + +1. Get LaraDock inside your Laravel project: +
+`git clone https://github.com/LaraDock/laradock.git`. +2. Enter the laradock folder and run only these Containers: +
+`docker-compose up -d nginx mysql redis` +3. Open your `.env` file and set `DB_HOST` to `mysql` and `REDIS_HOST` to `redis`. +4. Open your browser and visit the localhost: `http://localdock` + -```shell -docker-compose up nginx mysql redis -``` ### Features From 533925522c42ccccd0d9a3dedebbfd3ef9fe9e01 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 3 Aug 2016 13:08:00 +0300 Subject: [PATCH 67/75] add CONTRIBUTING.md --- CONTRIBUTING.md | 130 ++++++++++++++++++++++++++++++++++++++++++ README.md | 1 + php-fpm/Dockerfile-56 | 6 ++ php-fpm/Dockerfile-70 | 6 ++ workspace/Dockerfile | 6 ++ 5 files changed, 149 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9e1cedb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,130 @@ + + +# Contributing to LaraDock + +Your contribution is more than welcome. Let's keep LaraDock amazing. + + +### Got a Question or Problem? + +If you have questions about how to use LaraDock, please direct your questions to the discussion on [Gitter](https://gitter.im/LaraDock/laradock). If you beleave your question could help others, then consider opening an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as Question). + +### Found an Issue? +If you find a bug in the source code or a mistake in the documentation, you can help us by +submitting an [Issue](https://github.com/laradock/laradock/issues). Even better you can submit a Pull Request with a fix. + +### Want a Feature? +You can request a new feature by submitting an [Issue](https://github.com/laradock/laradock/issues) (it will be labeled as Feature Suggestion). If you would like to implement a new feature then consider submitting a Pull Request. + + +## Coding Guidelines + +### Support new Software + +* Create folder with the software name. + +* Add a `Dockerfile`, write your code there. + +* You may add additional files in the software folder. + +* Add the software to the `docker-compose.yml` file. + +* Make sure you follow our commenting style. + +* Add the software in the `Readme`. + +### Edit existing Software + +* Open the software (container) folder. + +* Edit the files you want to update. + +* **Note:** If you want to edit the base image of the `Workspace` or the `php-fpm` Containers, +you need to edit their Dockerfiles from their Github repositories. For more info read their Dockerfiles comment on the LaraDock repository. + +* Make sure to update the `Readme` incase you made any changes. + +## Issue/PR Submission Guidelines + +### Submitting an Issue +Before you submit your issue search the archive, maybe your question was already answered. + +If your issue appears to be a bug, and hasn't been reported, open a new issue. +Help us to maximize the effort we can spend fixing issues and adding new +features, by not reporting duplicate issues. + + + +### Submitting a Pull Request (PR) +Before you submit your pull request consider the following guidelines: + +* Search [GitHub](https://github.com/LaraDock/laradock/pulls) for an open or closed Pull Request that relates to your submission. You don't want to duplicate effort. + +* Make your changes in a new git branch: + + ```shell + git checkout -b my-fix-branch master + ``` +* Commit your changes using a descriptive commit message. + +* Push your branch to GitHub: + + ```shell + git push origin my-fix-branch + ``` + +* In GitHub, send a pull request to `laradock:master`. +* If we suggest changes then: + * Make the required updates. + * Commit your changes to your branch (e.g. `my-fix-branch`). + * Push the changes to your GitHub repository (this will update your Pull Request). + +> If the PR gets too outdated we may ask you to rebase and force push to update the PR: + +```shell +git rebase master -i +git push origin my-fix-branch -f +``` + +*WARNING. Squashing or reverting commits and forced push thereafter may remove GitHub comments on code that were previously made by you and others in your commits.* + + + + + + +### After your pull request is merged + +After your pull request is merged, you can safely delete your branch and pull the changes +from the main (upstream) repository: + +* Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows: + + ```shell + git push origin --delete my-fix-branch + ``` + +* Check out the master branch: + + ```shell + git checkout master -f + ``` + +* Delete the local branch: + + ```shell + git branch -D my-fix-branch + ``` + +* Update your master with the latest upstream version: + + ```shell + git pull --ff upstream master + ``` + + + + + +
+### Happy Coding :) \ No newline at end of file diff --git a/README.md b/README.md index d9388dd..49d5238 100644 --- a/README.md +++ b/README.md @@ -987,6 +987,7 @@ Moving from Docker Toolbox (VirtualBox) to Docker Native (for Mac/Windows). Requ This little project was built by one man who has a full time job and many responsibilities, so if you like this project and you find that it needs a bug fix or support for new software or upgrade any container, or anything else.. Do not hesitate to contribute, you are more than welcome :) +#### Read our [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md) ## Help & Questions diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 65b1bb7..07168d9 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -3,6 +3,12 @@ # Image Setup #-------------------------------------------------------------------------- # +# To edit the 'php-fpm' base Image, visit its repository on Github +# https://github.com/LaraDock/php-fpm +# +# To change its version, see the available Tags on the Docker Hub: +# https://hub.docker.com/r/laradock/php-fpm/tags/ +# FROM laradock/php-fpm:5.6--1.0 diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 1a994ef..88c85f2 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -3,6 +3,12 @@ # Image Setup #-------------------------------------------------------------------------- # +# To edit the 'php-fpm' base Image, visit its repository on Github +# https://github.com/LaraDock/php-fpm +# +# To change its version, see the available Tags on the Docker Hub: +# https://hub.docker.com/r/laradock/php-fpm/tags/ +# FROM laradock/php-fpm:7.0--1.0 diff --git a/workspace/Dockerfile b/workspace/Dockerfile index ab79cc3..ab5a718 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -3,6 +3,12 @@ # 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/ +# FROM laradock/workspace:1.0 From aa8f7c48a5509ccddf83b96abd5cff32b392dea7 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 3 Aug 2016 22:28:33 +0300 Subject: [PATCH 68/75] upgrade the php-fpm base images --- php-fpm/Dockerfile-56 | 2 +- php-fpm/Dockerfile-70 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 07168d9..08c30be 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -10,7 +10,7 @@ # https://hub.docker.com/r/laradock/php-fpm/tags/ # -FROM laradock/php-fpm:5.6--1.0 +FROM laradock/php-fpm:5.6--1.1 MAINTAINER Mahmoud Zalt diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index 88c85f2..ff7dbb5 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -10,7 +10,7 @@ # https://hub.docker.com/r/laradock/php-fpm/tags/ # -FROM laradock/php-fpm:7.0--1.0 +FROM laradock/php-fpm:7.0--1.1 MAINTAINER Mahmoud Zalt From 0f7969c999e79b9489a88828d90cd86582122504 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 3 Aug 2016 22:44:26 +0200 Subject: [PATCH 69/75] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49d5238..1e5cff8 100644 --- a/README.md +++ b/README.md @@ -351,7 +351,7 @@ docker-compose down 2 - enter any container using: ```bash -docker-composer exec {container-name} bash +docker-compose exec {container-name} bash ``` *Example: enter MySQL container* From ab4c44a434e2cb6a15dde29664df77133d383d47 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 3 Aug 2016 22:50:45 +0200 Subject: [PATCH 70/75] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49d5238..5a9524c 100644 --- a/README.md +++ b/README.md @@ -951,7 +951,7 @@ sudo chmod -R 777 storage bootstrap/cache #### I see "Welcome to nginx" instead of the Laravel App! -Use `http://127.0.0.1` (or [your Docker IP](#Find-Docker-IP-Address)) instead of `http://localhost` in your browser. +Use `http://127.0.0.1` instead of `http://localhost` in your browser. #### I see an error message containing `address already in use` From 57c003722e83b5a346afeb6df404ad8ac5231d8f Mon Sep 17 00:00:00 2001 From: David Date: Thu, 4 Aug 2016 23:10:27 +0200 Subject: [PATCH 71/75] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 49d5238..6099317 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,7 @@ What's better than a **Demo Video**: 1 - Clone the `LaraDock` repository: -**A)** If you already have a Laravel project, clone this repository on your `Laravel` root direcotry: +**A)** If you already have a Laravel project, clone this repository on your `Laravel` root directory: ```bash git submodule add https://github.com/LaraDock/laradock.git From f12028576c8564787d40d3820f2e280fbb01034f Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Wed, 10 Aug 2016 22:25:41 +0300 Subject: [PATCH 72/75] upgrade the workspace base image to 1.1 --- workspace/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index ab5a718..36fbaad 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -10,7 +10,7 @@ # https://hub.docker.com/r/laradock/workspace/tags/ # -FROM laradock/workspace:1.0 +FROM laradock/workspace:1.1 MAINTAINER Mahmoud Zalt From b393996d444d44a3d006b9de2d3e1b70bf670545 Mon Sep 17 00:00:00 2001 From: Suteepat Damrongyingsupab Date: Thu, 11 Aug 2016 18:03:27 +0700 Subject: [PATCH 73/75] Fixed nvm/node installation not working. --- workspace/Dockerfile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 36fbaad..f414f34 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -75,7 +75,7 @@ ARG PUID=1000 ARG PGID=1000 RUN groupadd -g $PGID laradock && \ useradd -u $PUID -g laradock -m laradock - + ##################################### # Composer: ##################################### @@ -102,17 +102,11 @@ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ # Check if NVM needs to be installed ARG INSTALL_NODE=true ENV INSTALL_NODE ${INSTALL_NODE} +ENV NVM_DIR /home/laradock/.nvm RUN if [ ${INSTALL_NODE} = true ]; then \ # Install nvm (A Node Version Manager) - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash \ -;fi -# Again check if NVM needs to be installed -# I had to split this condition link this because when I get it inside the above if statement is refuses to work! -ENV if [ ${INSTALL_NODE} = true ]; then \ - # Set the ENV - NVM_DIR=/home/laradock/.nvm \ - # Install NodeJS with NVM - RUN . ~/.nvm/nvm.sh && \ + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash && \ + . ~/.nvm/nvm.sh && \ nvm install stable && \ nvm use stable && \ nvm alias stable && \ From 82cbad75d42dc528c89db707172d6860f051d5f9 Mon Sep 17 00:00:00 2001 From: Mahmoud Zalt Date: Thu, 11 Aug 2016 21:24:20 +0300 Subject: [PATCH 74/75] Update the reamde: list more awesome contributors --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0675e20..91710d6 100644 --- a/README.md +++ b/README.md @@ -1006,6 +1006,9 @@ For special help with Docker and/or Laravel, you can schedule a live call with t **Main Contributors:** +- [Suteepat (tianissimo)](https://github.com/tianissimo) +- [David (davidavz)](https://github.com/davidavz) +- [Lialosiu](https://github.com/lialosiu) - [Eric Pfeiffer (computerfr33k)](https://github.com/computerfr33k) - [Orette](https://github.com/orette) - [Jack Fletcher (Kauhat)](https://github.com/Kauhat) From 1fdf800988af6365a62c32e291cd54db9862888b Mon Sep 17 00:00:00 2001 From: Lialosiu Date: Sun, 14 Aug 2016 15:53:08 +0800 Subject: [PATCH 75/75] add options INSTALL_ZIP_ARCHIVE to php-fpm --- docker-compose.yml | 1 + php-fpm/Dockerfile-56 | 13 +++++++++++++ php-fpm/Dockerfile-70 | 13 +++++++++++++ php-fpm/laravel.ini | 1 + 4 files changed, 28 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 2f9de80..a231318 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,6 +26,7 @@ services: args: - INSTALL_MONGO=false - INSTALL_XDEBUG=false + - INSTALL_ZIP_ARCHIVE=false dockerfile: Dockerfile-70 volumes_from: - volumes_source diff --git a/php-fpm/Dockerfile-56 b/php-fpm/Dockerfile-56 index 08c30be..fd88170 100644 --- a/php-fpm/Dockerfile-56 +++ b/php-fpm/Dockerfile-56 @@ -35,6 +35,7 @@ MAINTAINER Mahmoud Zalt # # - INSTALL_XDEBUG= false # - INSTALL_MONGO= false +# - INSTALL_ZIP_ARCHIVE= false # ##################################### @@ -60,6 +61,18 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ pecl install mongodb \ ;fi +##################################### +# ZipArchive: +##################################### + +ARG INSTALL_ZIP_ARCHIVE=true +ENV INSTALL_ZIP_ARCHIVE ${INSTALL_ZIP_ARCHIVE} +RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ + # Install the zip extention + pecl install zip \ +;fi + + # #-------------------------------------------------------------------------- # Final Touch diff --git a/php-fpm/Dockerfile-70 b/php-fpm/Dockerfile-70 index ff7dbb5..ed28119 100644 --- a/php-fpm/Dockerfile-70 +++ b/php-fpm/Dockerfile-70 @@ -35,6 +35,7 @@ MAINTAINER Mahmoud Zalt # # - INSTALL_XDEBUG= false # - INSTALL_MONGO= false +# - INSTALL_ZIP_ARCHIVE= false # ##################################### @@ -60,6 +61,18 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \ pecl install mongodb \ ;fi +##################################### +# ZipArchive: +##################################### + +ARG INSTALL_ZIP_ARCHIVE=true +ENV INSTALL_ZIP_ARCHIVE ${INSTALL_ZIP_ARCHIVE} +RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ + # Install the zip extention + pecl install zip \ +;fi + + # #-------------------------------------------------------------------------- # Final Touch diff --git a/php-fpm/laravel.ini b/php-fpm/laravel.ini index 186c8e1..dea3703 100644 --- a/php-fpm/laravel.ini +++ b/php-fpm/laravel.ini @@ -2,6 +2,7 @@ date.timezone=UTC display_errors=Off log_errors=On extension=mongodb.so +extension=zip.so ; Maximum amount of memory a script may consume (128MB) ; http://php.net/memory-limit