Compare commits

...

34 Commits

Author SHA1 Message Date
c4cd3ed2ac Merge pull request #365 from geocine/nginx-charset-utf8
use utf8 charset on nginx
2016-10-14 14:31:56 -04:00
ffe45fed50 use utf8 charset on nginx 2016-10-15 01:01:59 +08:00
bd1f6ebd8a Merge pull request #364 from LaraDock/downgrade-mysql
downgrade MySQL to 5.6 (stable)
2016-10-14 12:28:42 -04:00
f35e5501db downgrade MySQL to 5.6 (stable) 2016-10-14 12:26:11 -04:00
8d1ba2e802 Merge pull request #361 from LaraDock/yarn
Support Yarn package manager for JavaScript
2016-10-13 20:04:19 -05:00
c9415b12c0 Add YARN flag in production mode..
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-10-14 09:01:50 +08:00
8544de7ea1 update readme.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-10-13 14:48:00 +08:00
62e0f0443c Support Yarn MANAGEMENT tool.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-10-13 12:06:30 +08:00
a2847316c4 Merge pull request #358 from appleboy/patch-22
convert tab to spaces.
2016-10-11 12:49:43 -04:00
9d212afc8c convert tab to spaces.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-10-11 20:17:21 +08:00
89a77bee24 Merge pull request #354 from philtrep/change-timezone
Added timezone arguments to workspace build
2016-10-10 10:44:30 -04:00
fb26035e5c Added timezone arguments to workspace build 2016-10-10 09:44:25 -04:00
c7a76dd683 add LaraDock v4 Video link :D 2016-10-10 08:57:52 -04:00
781f5ff972 add missing info to the readme 2016-10-10 07:32:01 -04:00
5c0e55204e add folder structures to the README 2016-10-10 04:30:15 -04:00
dd3ab5ade1 add warning to the readme asking people to rebuild their containers 2016-10-10 03:50:44 -04:00
2e5d2a743c disable xdebug remote by default 2016-10-09 20:47:08 -04:00
5635b47c6f refactor the workspace docker file 2016-10-09 20:27:03 -04:00
56f422ade0 replace true parameters by false as the default 2016-10-09 20:05:33 -04:00
58d6d8e745 Merge pull request #352 from LaraDock/revert-db-ports
Revert ports fowarding for MySQL and MariaDB
2016-10-09 16:52:29 -04:00
7ecb712e76 Revert ports fowarding for MySQL and MariaDB
Include production docker compose file
2016-10-09 16:51:18 -04:00
3abb6152c8 Merge pull request #351 from philtrep/readme-mysql-host-access
Added instructions for forward the MySQL/MariaDB port to README
2016-10-09 13:57:57 -04:00
5221544b98 Added instructions for forward the MySQL/MariaDB port to README 2016-10-09 13:52:33 -04:00
2396b4799c Merge pull request #350 from geocine/cannot-open-nvm-sh-fix
fix for issue #347
2016-10-09 13:12:19 -04:00
08fa1bc95c fix for issue #347 2016-10-10 01:06:10 +08:00
2415566230 general updates to the readme 2016-10-09 02:26:50 -04:00
5fea003ffe update installation. 2016-10-09 11:19:50 +08:00
e9af2a4fb3 Merge branch 'master' of https://github.com/LaraDock/laradock
* 'master' of https://github.com/LaraDock/laradock:
  Fix typo in README: Giude -> Guide
  Added laravel cronjob
  Added cron files copying to workspace crontab
  Remove port fowarding for MySQL and MariaDB
  Added NVM binaries in root bashrc
2016-10-06 17:57:18 -04:00
d0dea21cc5 update readme credits section 2016-10-06 17:55:41 -04:00
942d1cfbed Merge pull request #340 from philtrep/workspace-cron
Simple cron jobs
2016-10-03 23:24:31 -04:00
57ec81ed52 Merge pull request #341 from rogeriopradoj/patch-1
Fix typo in README: Giude -> Guide
2016-10-03 23:23:33 -04:00
8d62070773 Fix typo in README: Giude -> Guide 2016-10-03 23:51:48 -03:00
8933b827b3 Added laravel cronjob 2016-10-03 20:29:45 -04:00
6f435584a9 Added cron files copying to workspace crontab 2016-10-03 20:21:28 -04:00
12 changed files with 375 additions and 153 deletions

View File

@ -957,21 +957,6 @@ Docker或Laravel的特别帮助你可以在[Codementor.io](https://www.codeme
- [Mahmoud Zalt](https://github.com/Mahmoudz) (Twitter [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt)) - [Mahmoud Zalt](https://github.com/Mahmoudz) (Twitter [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt))
**主要 贡献者:**
- [Zhqagp](https://github.com/zhqagp)
- [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)
- [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)
**优秀的人:** **优秀的人:**
- [Contributors](https://github.com/LaraDock/laradock/graphs/contributors) - [Contributors](https://github.com/LaraDock/laradock/graphs/contributors)

207
README.md
View File

@ -58,12 +58,17 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
- [Install xDebug](#Install-xDebug) - [Install xDebug](#Install-xDebug)
- [Start/Stop xDebug](#Controll-xDebug) - [Start/Stop xDebug](#Controll-xDebug)
- [Production](#Production) - [Production](#Production)
- [Prepare LaraDock for Production](#LaraDock-for-Production)
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean) - [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
- [Misc](#Misc) - [Misc](#Misc)
- [Change the timezone](#Change-the-timezone)
- [Cron jobs](#CronJobs)
- [MySQL access from host](#MySQL-access-from-host)
- [Use custom Domain](#Use-custom-Domain) - [Use custom Domain](#Use-custom-Domain)
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install) - [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
- [Install Prestissimo](#Install-Prestissimo) - [Install Prestissimo](#Install-Prestissimo)
- [Install Node + NVM](#Install-Node) - [Install Node + NVM](#Install-Node)
- [Install Node + YARN](#Install-Yarn)
- [Debugging](#debugging) - [Debugging](#debugging)
- [Upgrading LaraDock](#upgrading-laradock) - [Upgrading LaraDock](#upgrading-laradock)
- [Help & Questions](#Help) - [Help & Questions](#Help)
@ -189,8 +194,8 @@ Running a virtual Container is much faster than running a full virtual Machine.
What's better than a **Demo Video**: What's better than a **Demo Video**:
- LaraDock v4.* (Coming soon..) - LaraDock [v4.*](https://www.youtube.com/watch?v=TQii1jDa96Y)
- LaraDock [v2.2](https://www.youtube.com/watch?v=-DamFMczwDA) - LaraDock [v2.*](https://www.youtube.com/watch?v=-DamFMczwDA)
- LaraDock [v0.3](https://www.youtube.com/watch?v=jGkyO6Is_aI) - LaraDock [v0.3](https://www.youtube.com/watch?v=jGkyO6Is_aI)
- LaraDock [v0.1](https://www.youtube.com/watch?v=3YQsHe6oF80) - LaraDock [v0.1](https://www.youtube.com/watch?v=3YQsHe6oF80)
@ -208,7 +213,7 @@ What's better than a **Demo Video**:
## Installation ## Installation
1 - Clone the `LaraDock` repository: Clone the `LaraDock` repository:
**A)** If you already have a Laravel project, clone this repository on your `Laravel` root directory: **A)** If you already have a Laravel project, clone this repository on your `Laravel` root directory:
@ -217,13 +222,32 @@ git submodule add https://github.com/LaraDock/laradock.git
``` ```
>If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`. >If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.
Note: In this case the folder structure will be like this (recommended):
```
- project1
- laradock
- project2
- laradock
```
<br>
**B)** If you don't have a Laravel project, and you want to install Laravel from Docker, clone this repo anywhere on your machine: **B)** If you don't have a Laravel project, and you want to install Laravel from Docker, clone this repo anywhere on your machine:
```bash ```bash
git clone https://github.com/LaraDock/laradock.git git clone https://github.com/LaraDock/laradock.git
``` ```
Note: In this case the folder structure will be like this:
```
- projects
- laradock
- project1
- project2
```
**Note:** if you are using this folder structure don't forget to edit the `docker-compose.yml` file to map to your Laravel directory once you have it (example: `- ../project1/:/var/www/laravel`). "You will need to stop and re-run your docker-compose command for the changes to take place".
<a name="Usage"></a> <a name="Usage"></a>
## Usage ## Usage
@ -236,13 +260,12 @@ 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) - 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)). - Use LaraDock v3.* (Visit the `LaraDock-ToolBox` [Branch](https://github.com/LaraDock/laradock/tree/LaraDock-ToolBox)).
<br>
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. >**Warning:** If you used an older version of LaraDock it's highly recommended to rebuild the containers you need to use [see how you rebuild a container](#Build-Re-build-Containers) in order to prevent errors as much as possible.
<br> <br>
<br>
1 - Run 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).*
@ -253,13 +276,14 @@ If you are using **Docker Native** (For Mac/Windows) or even for Linux, continue
docker-compose up -d nginx mysql docker-compose up -d nginx mysql
``` ```
**Note**: The `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command. If you couldn't find them running then you need specify them as follow: `docker-compose up -d nginx php-fpm mysql workspace`.
You can select your own combination of Containers form the list below: You can select your own combination of Containers form the list below:
`nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`, `aerospike`, `pgadmin`, `elasticsearch`. `nginx`, `hhvm`, `php-fpm`, `mysql`, `redis`, `postgres`, `mariadb`, `neo4j`, `mongo`, `apache2`, `caddy`, `memcached`, `beanstalkd`, `beanstalkd-console`, `rabbitmq`, `workspace`, `phpmyadmin`, `aerospike`, `pgadmin`, `elasticsearch`.
**Note**: `workspace` and `php-fpm` will run automatically in most of the cases, so no need to specify them in the `up` command.
<br> <br>
@ -268,14 +292,13 @@ You can select your own combination of Containers form the list below:
```bash ```bash
docker-compose exec workspace bash docker-compose exec workspace bash
``` ```
<br /> Alternatively, for Windows Powershell users: execute the following command to enter any running container:
<br>
2a - Alternatively, Windows Powershell users can execute the following command to enter a running container.
```bash ```bash
docker exec -it {container-id} bash docker exec -it {workspace-container-id} bash
``` ```
<br />
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`). **Note:** You can 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`).
@ -399,15 +422,17 @@ Examples:
Change MySQL Database Name: Change MySQL Database Name:
```yml ```yml
environment: environment:
MYSQL_DATABASE: laradock MYSQL_DATABASE: laradock
...
``` ```
Change Redis defaut port to 1111: Change Redis defaut port to 1111:
```yml ```yml
ports: ports:
- "1111:6379" - "1111:6379"
...
``` ```
@ -526,6 +551,7 @@ Since the new Laravel application is in the `my-cool-app` folder, we need to rep
build: ./application build: ./application
volumes: volumes:
- ../my-cool-app/:/var/www/laravel - ../my-cool-app/:/var/www/laravel
...
``` ```
4 - Go to that folder and start working.. 4 - Go to that folder and start working..
@ -802,11 +828,12 @@ By default **PHP-FPM 7.0** is running.
3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this: 3 - Change the version number, by replacing `Dockerfile-70` with `Dockerfile-56`, like this:
```txt ```yml
php-fpm: php-fpm:
build: build:
context: ./php-fpm context: ./php-fpm
dockerfile: Dockerfile-70 dockerfile: Dockerfile-70
...
``` ```
4 - Finally rebuild the container 4 - Finally rebuild the container
@ -894,6 +921,13 @@ 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`
3 - Open `laradock/workspace/xdebug.ini` and/or `laradock/php-fpm/xdebug.ini` and enable at least the following configs:
```
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
```
For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm). For information on how to configure xDebug with your IDE and work it out, check this [Repository](https://github.com/LarryEitel/laravel-laradock-phpstorm).
@ -920,11 +954,31 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the
<br>
<a name="LaraDock-for-Production"></a>
### Prepare LaraDock for Production
It's recommended for production to create a custom `docker-compose.yml` file. For that reason LaraDock is shipped with `production-docker-compose.yml` which should contain only the containers you are planning to run on production (usage exampe: `docker-compose -f production-docker-compose.yml up -d nginx mysql redis ...`).
Note: The Database (MySQL/MariaDB/...) ports should not be forwarded on production, because Docker will automatically publish the port on the host, which is quite insecure, unless specifically told not to. So make sure to remove these lines:
```
ports:
- "3306:3306"
```
To learn more about how Docker publishes ports, please read [this excellent post on the subject](https://fralef.me/docker-and-iptables.html).
<br> <br>
<a name="Digital-Ocean"></a> <a name="Digital-Ocean"></a>
### Setup Laravel and Docker on Digital Ocean ### Setup Laravel and Docker on Digital Ocean
####[Full Giude Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md) ####[Full Guide Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
@ -936,6 +990,49 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the
<br> <br>
<a name="Change-the-timezone"></a>
### Change the timezone
To change the timezone for the `workspace` container, modify the `TZ` build argument in the Docker Compose file to one in the [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
For example, if I want the timezone to be `New York`:
```yml
workspace:
build:
context: ./workspace
args:
- TZ=America/New_York
...
```
We also recommend [setting the timezone in Laravel](http://www.camroncade.com/managing-timezones-with-laravel/).
<a name="CronJobs"></a>
### Adding cron jobs
You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line.
```
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1
# Custom cron
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
```
Make sure you [change the timezone](#Change-the-timezone) if you don't want to use the default (UTC).
<a name="MySQL-access-from-host"></a>
### MySQL access from host
You can forward the MySQL/MariaDB port to your host by making sure these lines are added to the `mysql` or `mariadb` section of the `docker-compose.yml` or in your [environment specific Compose](https://docs.docker.com/compose/extends/) file.
```
ports:
- "3306:3306"
```
<a name="Use-custom-Domain"></a> <a name="Use-custom-Domain"></a>
### Use custom Domain (instead of the Docker IP) ### Use custom Domain (instead of the Docker IP)
@ -1029,6 +1126,30 @@ It should be like this:
3 - Re-build the container `docker-compose build workspace` 3 - Re-build the container `docker-compose build workspace`
<br>
<a name="Install-Yarn"></a>
### Install Node + YARN
Yarn is a new package manager for JavaScript. It is so faster than npm, which you can find [here](http://yarnpkg.com/en/compare).To install NodeJS and [Yarn](https://yarnpkg.com/) in the Workspace container:
1 - Open the `docker-compose.yml` file
2 - Search for the `INSTALL_NODE` and `INSTALL_YARN` argument under the Workspace Container and set it to `true`
It should be like this:
```yml
workspace:
build:
context: ./workspace
args:
- INSTALL_NODE=true
- INSTALL_YARN=true
...
```
3 - Re-build the container `docker-compose build workspace`
<br> <br>
<a name="Install-Aerospike-Extension"></a> <a name="Install-Aerospike-Extension"></a>
### Install Aerospike extension ### Install Aerospike extension
@ -1133,6 +1254,9 @@ This little project was built by one man who has a full time job and many respon
#### Read the [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md). #### Read the [Contribution Guidelines](https://github.com/LaraDock/laradock/blob/master/CONTRIBUTING.md).
<a name="Help"></a> <a name="Help"></a>
## Help & Questions ## Help & Questions
@ -1142,33 +1266,40 @@ You can as well can open an [issue](https://github.com/laradock/laradock/issues)
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). 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 ## Credits
**Creator:**
- [Mahmoud Zalt](https://github.com/Mahmoudz) [ [Twitter](https://twitter.com/Mahmoud_Zalt) | [Personal Site](http://zalt.me) | [Linkedin](https://www.linkedin.com/in/mahmoudzalt) ]
**Admins:** **Admins:**
- [Mahmoud Zalt](https://github.com/Mahmoudz) **Creator** (Twitter [@Mahmoud_Zalt](https://twitter.com/Mahmoud_Zalt)) - [Bo-Yi Wu](https://github.com/appleboy) (appleboy)
- [Bo-Yi Wu (appleboy)](https://github.com/appleboy) - [Philippe Trépanier](https://github.com/philtrep) (philtrep)
**Main Contributors:** **Main Contributors:**
- [Francis Lavoie (francislavoie)](https://github.com/francislavoie) - [Francis Lavoie](https://github.com/francislavoie) (francislavoie)
- [luciano-jr](https://github.com/luciano-jr) - [luciano-jr](https://github.com/luciano-jr)
- [Zhqagp](https://github.com/zhqagp) - [Zhqagp](https://github.com/zhqagp)
- [Tim B (tjb328)](https://github.com/tjb328) - [Tim B.](https://github.com/tjb328) (tjb328)
- [MidasCodeBreaker](https://github.com/midascodebreaker) - [MidasCodeBreaker](https://github.com/midascodebreaker)
- [Larry Eitel (LarryEitel)](https://github.com/LarryEitel) - [Larry Eitel](https://github.com/LarryEitel)
- [Suteepat (tianissimo)](https://github.com/tianissimo) - [Suteepat](https://github.com/tianissimo) (tianissimo)
- [David (davidavz)](https://github.com/davidavz) - [David](https://github.com/davidavz) (davidavz)
- [Lialosiu](https://github.com/lialosiu) - [Lialosiu](https://github.com/lialosiu)
- [Eric Pfeiffer (computerfr33k)](https://github.com/computerfr33k) - [Eric Pfeiffer](https://github.com/computerfr33k) (computerfr33k)
- [Orette](https://github.com/orette) - [Orette](https://github.com/orette)
- [Jack Fletcher (Kauhat)](https://github.com/Kauhat) - [Jack Fletcher](https://github.com/Kauhat) (Kauhat)
- [Amin Mkh (AminMkh)](https://github.com/AminMkh) - [Amin Mkh](https://github.com/AminMkh)
- [Matthew Tonkin Dunn (mattythebatty)](https://github.com/mattythebatty) - [Matthew Tonkin Dunn](https://github.com/mattythebatty) (mattythebatty)
- [Zhivitsa Kirill (zhikiri)](https://github.com/zhikiri) - [Zhivitsa Kirill](https://github.com/zhikiri) (zhikiri)
- [Benmag](https://github.com/benmag) - [Benmag](https://github.com/benmag)
**Awesome People:** **Other Contributors & Supporters:**
- [Contributors](https://github.com/LaraDock/laradock/graphs/contributors) - [Contributors](https://github.com/LaraDock/laradock/graphs/contributors)
- [Supporters](https://github.com/LaraDock/laradock/issues?utf8=%E2%9C%93&q=) - [Supporters](https://github.com/LaraDock/laradock/issues?utf8=%E2%9C%93&q=)

View File

@ -11,6 +11,7 @@ services:
- INSTALL_XDEBUG=false - INSTALL_XDEBUG=false
- INSTALL_MONGO=false - INSTALL_MONGO=false
- INSTALL_NODE=false - INSTALL_NODE=false
- INSTALL_YARN=false
- INSTALL_DRUSH=false - INSTALL_DRUSH=false
- INSTALL_AEROSPIKE_EXTENSION=false - INSTALL_AEROSPIKE_EXTENSION=false
- COMPOSER_GLOBAL_INSTALL=false - COMPOSER_GLOBAL_INSTALL=false
@ -18,6 +19,7 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- NODE_VERSION=stable - NODE_VERSION=stable
- TZ=UTC
volumes_from: volumes_from:
- volumes_source - volumes_source
extra_hosts: extra_hosts:
@ -104,6 +106,22 @@ services:
build: ./mysql build: ./mysql
volumes_from: volumes_from:
- volumes_data - volumes_data
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
### MariaDB Container #######################################
mariadb:
build: ./mariadb
volumes_from:
- volumes_data
ports:
- "3306:3306"
environment: environment:
MYSQL_DATABASE: homestead MYSQL_DATABASE: homestead
MYSQL_USER: homestead MYSQL_USER: homestead
@ -123,18 +141,6 @@ services:
POSTGRES_USER: homestead POSTGRES_USER: homestead
POSTGRES_PASSWORD: secret POSTGRES_PASSWORD: secret
### MariaDB Container #######################################
mariadb:
build: ./mariadb
volumes_from:
- volumes_data
environment:
MYSQL_DATABASE: homestead
MYSQL_USER: homestead
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
### Neo4j Container ######################################### ### Neo4j Container #########################################
neo4j: neo4j:
@ -287,9 +293,6 @@ services:
image: tianon/true image: tianon/true
volumes: volumes:
- ../:/var/www/laravel - ../:/var/www/laravel
# Demonstration of how to mount multiple sites
# - ../../site_a/:/var/www/site_a
# - ../../site_b/:/var/www/site_b
### Databases Data Container ################################ ### Databases Data Container ################################

View File

@ -1,4 +1,4 @@
FROM mysql:latest FROM mysql:mysql:5.6
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>

View File

@ -26,4 +26,5 @@ http {
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-available/*; include /etc/nginx/sites-available/*;
open_file_cache max=100; open_file_cache max=100;
charset UTF-8;
} }

View File

@ -40,7 +40,7 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
# xDebug: # xDebug:
##################################### #####################################
ARG INSTALL_XDEBUG=true ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension # Install the xdebug extension
pecl install xdebug && \ pecl install xdebug && \
@ -54,7 +54,7 @@ COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
# MongoDB: # MongoDB:
##################################### #####################################
ARG INSTALL_MONGO=true ARG INSTALL_MONGO=false
RUN if [ ${INSTALL_MONGO} = true ]; then \ RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension # Install the mongodb extension
pecl install mongodb && \ pecl install mongodb && \
@ -65,7 +65,7 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
# ZipArchive: # ZipArchive:
##################################### #####################################
ARG INSTALL_ZIP_ARCHIVE=true ARG INSTALL_ZIP_ARCHIVE=false
RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# Install the zip extension # Install the zip extension
pecl install zip && \ pecl install zip && \
@ -76,7 +76,7 @@ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# PHP Memcached: # PHP Memcached:
##################################### #####################################
ARG INSTALL_MEMCACHED=true ARG INSTALL_MEMCACHED=false
RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# Install the php memcached extension # Install the php memcached extension
pecl install memcached && \ pecl install memcached && \
@ -87,7 +87,7 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# PHP Aerospike: # PHP Aerospike:
##################################### #####################################
ARG INSTALL_AEROSPIKE_EXTENSION=true ARG INSTALL_AEROSPIKE_EXTENSION=false
ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION} ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
# Copy aerospike configration for remote debugging # Copy aerospike configration for remote debugging
COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini
@ -108,7 +108,7 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
##################################### #####################################
# Opcache: # Opcache:
##################################### #####################################
ARG INSTALL_OPCACHE=true ARG INSTALL_OPCACHE=false
RUN if [ ${INSTALL_OPCACHE} = true ]; then \ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache && \ docker-php-ext-install opcache && \
docker-php-ext-enable opcache \ docker-php-ext-enable opcache \

View File

@ -34,13 +34,14 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
# in the `docker-compose.yml` before the build. # in the `docker-compose.yml` before the build.
# Example: # Example:
# - INSTALL_ZIP_ARCHIVE=true # - INSTALL_ZIP_ARCHIVE=true
# - ...
# #
##################################### #####################################
# xDebug: # xDebug:
##################################### #####################################
ARG INSTALL_XDEBUG=true ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \ RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Install the xdebug extension # Install the xdebug extension
pecl install xdebug && \ pecl install xdebug && \
@ -54,7 +55,7 @@ COPY ./xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
# MongoDB: # MongoDB:
##################################### #####################################
ARG INSTALL_MONGO=true ARG INSTALL_MONGO=false
RUN if [ ${INSTALL_MONGO} = true ]; then \ RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension # Install the mongodb extension
pecl install mongodb && \ pecl install mongodb && \
@ -65,7 +66,7 @@ RUN if [ ${INSTALL_MONGO} = true ]; then \
# ZipArchive: # ZipArchive:
##################################### #####################################
ARG INSTALL_ZIP_ARCHIVE=true ARG INSTALL_ZIP_ARCHIVE=false
RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# Install the zip extension # Install the zip extension
pecl install zip && \ pecl install zip && \
@ -76,7 +77,7 @@ RUN if [ ${INSTALL_ZIP_ARCHIVE} = true ]; then \
# PHP Memcached: # PHP Memcached:
##################################### #####################################
ARG INSTALL_MEMCACHED=true ARG INSTALL_MEMCACHED=false
RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# Install the php memcached extension # Install the php memcached extension
curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \ curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/php7.tar.gz" \
@ -98,7 +99,7 @@ RUN if [ ${INSTALL_MEMCACHED} = true ]; then \
# PHP Aerospike: # PHP Aerospike:
##################################### #####################################
ARG INSTALL_AEROSPIKE_EXTENSION=true ARG INSTALL_AEROSPIKE_EXTENSION=false
ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION} ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
# Copy aerospike configration for remote debugging # Copy aerospike configration for remote debugging
COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini COPY ./aerospike.ini /usr/local/etc/php/conf.d/aerospike.ini
@ -119,7 +120,7 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
##################################### #####################################
# Opcache: # Opcache:
##################################### #####################################
ARG INSTALL_OPCACHE=true ARG INSTALL_OPCACHE=false
RUN if [ ${INSTALL_OPCACHE} = true ]; then \ RUN if [ ${INSTALL_OPCACHE} = true ]; then \
docker-php-ext-install opcache && \ docker-php-ext-install opcache && \
docker-php-ext-enable opcache \ docker-php-ext-enable opcache \

View File

@ -1,9 +1,10 @@
; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini) ; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
xdebug.remote_autostart=1 xdebug.remote_autostart=0
xdebug.remote_enable=1 xdebug.remote_enable=0
xdebug.remote_connect_back=1 xdebug.remote_connect_back=0
xdebug.cli_color=1 xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.remote_handler=dbgp xdebug.remote_handler=dbgp
xdebug.remote_mode=req xdebug.remote_mode=req

View File

@ -0,0 +1,62 @@
version: '2'
services:
### Workspace Utilities Container ###########################
workspace:
build:
context: ./workspace
args:
- INSTALL_XDEBUG=false
- INSTALL_MONGO=false
- INSTALL_NODE=false
- INSTALL_YARN=false
- INSTALL_DRUSH=false
- INSTALL_AEROSPIKE_EXTENSION=false
- COMPOSER_GLOBAL_INSTALL=false
- INSTALL_WORKSPACE_SSH=false
- PUID=1000
- PGID=1000
- NODE_VERSION=stable
volumes_from:
- volumes_source
ports:
- "22:22"
tty: true
### PHP-FPM Container #######################################
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_XDEBUG=false
- INSTALL_MONGO=false
- INSTALL_ZIP_ARCHIVE=false
- INSTALL_MEMCACHED=false
- INSTALL_OPCACHE=false
- INSTALL_AEROSPIKE_EXTENSION=false
dockerfile: Dockerfile-70
volumes_from:
- volumes_source
expose:
- "9000"
links:
- workspace
### Laravel Application Code Container ######################
volumes_source:
image: tianon/true
volumes:
- ../:/var/www/laravel
### Databases Data Container ################################
volumes_data:
image: tianon/true
volumes:
# - ./data/mysql:/var/lib/mysql
### Add All your Software Containers below ###############################

View File

@ -32,65 +32,10 @@ MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
# #
# Optional Software's will only be installed if you set them to `true` # Optional Software's will only be installed if you set them to `true`
# in the `docker-compose.yml` before the build. # in the `docker-compose.yml` before the build.
# Example:
# - INSTALL_NODE=false
# - ...
# #
# - INSTALL_XDEBUG= false
# - INSTALL_MONGO= false
# - COMPOSER_GLOBAL_INSTALL= false
# - INSTALL_NODE= false
# - INSTALL_DRUSH= false
#
#####################################
# xDebug:
#####################################
# 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 update && \
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
# ADD for REMOTE debugging
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
#####################################
# ssh:
#####################################
# Check if ssh needs to be installed
# See: https://github.com/phusion/baseimage-docker#enabling_ssh
ADD insecure_id_rsa /tmp/id_rsa
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
ARG INSTALL_WORKSPACE_SSH=true
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
rm -f /etc/service/sshd/down && \
cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \
&& cat /tmp/id_rsa.pub >> /root/.ssh/id_rsa.pub \
&& cat /tmp/id_rsa >> /root/.ssh/id_rsa \
&& rm -f /tmp/id_rsa* \
&& chmod 644 /root/.ssh/authorized_keys /root/.ssh/id_rsa.pub \
&& chmod 400 /root/.ssh/id_rsa \
;fi
#####################################
# MongoDB:
#####################################
# Check if Mongo needs to be installed
ARG INSTALL_MONGO=true
ENV INSTALL_MONGO ${INSTALL_MONGO}
RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension
pecl install mongodb && \
echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \
;fi
##################################### #####################################
# Non-Root User: # Non-Root User:
@ -102,6 +47,14 @@ ARG PGID=1000
RUN groupadd -g $PGID laradock && \ RUN groupadd -g $PGID laradock && \
useradd -u $PUID -g laradock -m laradock useradd -u $PUID -g laradock -m laradock
#####################################
# Set Timezone
#####################################
ARG TZ=UTC
ENV TZ ${TZ}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
##################################### #####################################
# Composer: # Composer:
##################################### #####################################
@ -114,19 +67,73 @@ RUN chown -R laradock:laradock /home/laradock/.composer
USER laradock USER laradock
# Check if global install need to be ran # Check if global install need to be ran
ARG COMPOSER_GLOBAL_INSTALL=true ARG COMPOSER_GLOBAL_INSTALL=false
ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL} ENV COMPOSER_GLOBAL_INSTALL ${COMPOSER_GLOBAL_INSTALL}
RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \ RUN if [ ${COMPOSER_GLOBAL_INSTALL} = true ]; then \
# run the install # run the install
composer global install \ composer global install \
;fi ;fi
#####################################
# Crontab
#####################################
USER root
COPY ./crontab /var/spool/cron/crontabs
#####################################
# xDebug:
#####################################
ARG INSTALL_XDEBUG=false
RUN if [ ${INSTALL_XDEBUG} = true ]; then \
# Load the xdebug extension only with phpunit commands
apt-get update && \
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
# ADD for REMOTE debugging
COPY ./xdebug.ini /etc/php/7.0/cli/conf.d/xdebug.ini
#####################################
# ssh:
#####################################
ARG INSTALL_WORKSPACE_SSH=false
ENV INSTALL_WORKSPACE_SSH ${INSTALL_WORKSPACE_SSH}
ADD insecure_id_rsa /tmp/id_rsa
ADD insecure_id_rsa.pub /tmp/id_rsa.pub
RUN if [ ${INSTALL_WORKSPACE_SSH} = true ]; then \
rm -f /etc/service/sshd/down && \
cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys \
&& cat /tmp/id_rsa.pub >> /root/.ssh/id_rsa.pub \
&& cat /tmp/id_rsa >> /root/.ssh/id_rsa \
&& rm -f /tmp/id_rsa* \
&& chmod 644 /root/.ssh/authorized_keys /root/.ssh/id_rsa.pub \
&& chmod 400 /root/.ssh/id_rsa \
;fi
#####################################
# MongoDB:
#####################################
# Check if Mongo needs to be installed
ARG INSTALL_MONGO=false
ENV INSTALL_MONGO ${INSTALL_MONGO}
RUN if [ ${INSTALL_MONGO} = true ]; then \
# Install the mongodb extension
pecl install mongodb && \
echo "extension=mongodb.so" >> /etc/php/7.0/cli/php.ini \
;fi
##################################### #####################################
# Drush: # Drush:
##################################### #####################################
USER root USER root
ENV DRUSH_VERSION 8.1.2 ENV DRUSH_VERSION 8.1.2
ARG INSTALL_DRUSH=true ARG INSTALL_DRUSH=false
ENV INSTALL_DRUSH ${INSTALL_DRUSH} ENV INSTALL_DRUSH ${INSTALL_DRUSH}
RUN if [ ${INSTALL_DRUSH} = true ]; then \ RUN if [ ${INSTALL_DRUSH} = true ]; then \
# Install Drush 8 with the phar file. # Install Drush 8 with the phar file.
@ -144,13 +151,13 @@ USER laradock
# Check if NVM needs to be installed # Check if NVM needs to be installed
ARG NODE_VERSION=stable ARG NODE_VERSION=stable
ENV NODE_VERSION ${NODE_VERSION} ENV NODE_VERSION ${NODE_VERSION}
ARG INSTALL_NODE=true ARG INSTALL_NODE=false
ENV INSTALL_NODE ${INSTALL_NODE} ENV INSTALL_NODE ${INSTALL_NODE}
ENV NVM_DIR /home/laradock/.nvm ENV NVM_DIR /home/laradock/.nvm
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
# Install nvm (A Node Version Manager) # Install nvm (A Node Version Manager)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh | bash && \ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh | bash && \
. ~/.nvm/nvm.sh && \ . $NVM_DIR/nvm.sh && \
nvm install ${NODE_VERSION} && \ nvm install ${NODE_VERSION} && \
nvm use ${NODE_VERSION} && \ nvm use ${NODE_VERSION} && \
nvm alias ${NODE_VERSION} && \ nvm alias ${NODE_VERSION} && \
@ -167,20 +174,48 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
# Add NVM binaries to root's .bashrc # Add NVM binaries to root's .bashrc
USER root USER root
RUN if [ ${INSTALL_NODE} = true ]; then \ RUN if [ ${INSTALL_NODE} = true ]; then \
echo "" >> ~/.bashrc && \ echo "" >> ~/.bashrc && \
echo 'export NVM_DIR="/home/laradock/.nvm"' >> ~/.bashrc && \ echo 'export NVM_DIR="/home/laradock/.nvm"' >> ~/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \ echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
;fi ;fi
#####################################
# YARN:
#####################################
USER laradock
ARG INSTALL_YARN=false
ENV INSTALL_YARN ${INSTALL_YARN}
RUN if [ ${INSTALL_YARN} = true ]; then \
curl -o- -L https://yarnpkg.com/install.sh | bash && \
echo "" >> ~/.bashrc && \
echo 'export PATH="$HOME/.yarn/bin:$PATH"' >> ~/.bashrc \
;fi
# Add YARN binaries to root's .bashrc
USER root
RUN if [ ${INSTALL_YARN} = true ]; then \
echo "" >> ~/.bashrc && \
echo 'export YARN_DIR="/home/laradock/.yarn"' >> ~/.bashrc && \
echo 'export PATH="$YARN_DIR/bin:$PATH"' >> ~/.bashrc \
;fi
##################################### #####################################
# PHP Aerospike: # PHP Aerospike:
##################################### #####################################
USER root USER root
ARG INSTALL_AEROSPIKE_EXTENSION=true ARG INSTALL_AEROSPIKE_EXTENSION=true
ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION} ENV INSTALL_AEROSPIKE_EXTENSION ${INSTALL_AEROSPIKE_EXTENSION}
# Copy aerospike configration for remote debugging # Copy aerospike configration for remote debugging
COPY ./aerospike.ini /etc/php/7.0/cli/conf.d/aerospike.ini COPY ./aerospike.ini /etc/php/7.0/cli/conf.d/aerospike.ini
RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
# Install the php aerospike extension # Install the php aerospike extension
curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \ curl -L -o /tmp/aerospike-client-php.tar.gz "https://github.com/luciano-jr/aerospike-client-php/archive/master.tar.gz" \
@ -194,6 +229,7 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = true ]; then \
) \ ) \
&& rm /tmp/aerospike-client-php.tar.gz \ && rm /tmp/aerospike-client-php.tar.gz \
;fi ;fi
RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \
rm /etc/php/7.0/cli/conf.d/aerospike.ini \ rm /etc/php/7.0/cli/conf.d/aerospike.ini \
;fi ;fi

1
workspace/crontab/root Normal file
View File

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

View File

@ -1,9 +1,10 @@
; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini) ; NOTE: The actual debug.so extention is NOT SET HERE but rather (/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini)
xdebug.remote_autostart=1 xdebug.remote_autostart=0
xdebug.remote_enable=1 xdebug.remote_enable=0
xdebug.remote_connect_back=1 xdebug.remote_connect_back=0
xdebug.cli_color=1 xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.remote_handler=dbgp xdebug.remote_handler=dbgp
xdebug.remote_mode=req xdebug.remote_mode=req