Merge pull request #14 from laradock/master

Just update the fork repository
This commit is contained in:
Luciano Jr 2016-12-07 13:18:41 +00:00 committed by GitHub
commit e372d624a6
59 changed files with 1270 additions and 513 deletions

View File

@ -7,9 +7,7 @@
LaraDock能够帮你在**Docker**上快速搭建**Laravel**应用。 LaraDock能够帮你在**Docker**上快速搭建**Laravel**应用。
<br> <br>
就像Laravel Homestead一样但是Docker替换了Vagrant。 就像Laravel Homestead一样但是Docker替换了Vagrant。
>先在Docker上使用LaraDock然后再学习它们。 > 先在使用 LaraDock然后再学习它们。
![](https://s31.postimg.org/nbettdki3/lara_dock_poster_new.jpg)
<br> <br>
## 目录 ## 目录
@ -471,13 +469,13 @@ composer create-project laravel/laravel my-cool-app "5.2.*"
系统默认LaraDock假定Laravel应用在LaraDock的父级目录中 系统默认LaraDock假定Laravel应用在LaraDock的父级目录中
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.
自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www/laravel`替换 `../:/var/www/laravel` , 如下: 自新Laravel应用在 `my-cool-app` 目录中, 我们需要用 `../my-cool-app/:/var/www`替换 `../:/var/www` , 如下:
```yaml ```yaml
application: application:
build: ./application build: ./application
volumes: volumes:
- ../my-cool-app/:/var/www/laravel - ../my-cool-app/:/var/www
``` ```
4 - 进入目录下继续工作.. 4 - 进入目录下继续工作..
@ -957,21 +955,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)

763
README.md

File diff suppressed because it is too large Load Diff

View File

@ -58,10 +58,10 @@ docker-compose exec workspace bash
#### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder #### Install laravel Dependencies, Add .env , generate Key and give proper permission certain folder
``` ```
$ root@0e77851d27d3:/var/www/laravel# composer install $ root@0e77851d27d3:/var/www# composer install
$ root@0e77851d27d3:/var/www/laravel# cp .env.example .env $ root@0e77851d27d3:/var/www# cp .env.example .env
$ root@0e77851d27d3:/var/www/laravel# php artisan key:generate $ root@0e77851d27d3:/var/www# php artisan key:generate
$ root@0e77851d27d3:/var/www/laravel# exit $ root@0e77851d27d3:/var/www# exit
$root@midascode:~/laravel/laradock# cd .. $root@midascode:~/laravel/laradock# cd ..
$root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache $root@midascode:~/laravel# sudo chmod -R 777 storage bootstrap/cache
``` ```
@ -141,13 +141,13 @@ Remove 0.0.0.0:80
``` ```
0.0.0.0:80 0.0.0.0:80
root /var/www/laravel/public root /var/www/public
``` ```
and replace with your https://yourdomain.com and replace with your https://yourdomain.com
``` ```
https://yourdomain.com https://yourdomain.com
root /var/www/laravel/public root /var/www/public
``` ```
uncomment tls uncomment tls

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

302
_guides/phpstorm.md Normal file
View File

@ -0,0 +1,302 @@
# PHPStorm Debugging Guide
- [Intro](#Intro)
- [Installation](#Installation)
- [Customize laradock/docker-compose.yml](#CustomizeDockerCompose)
- [Clean House](#InstallCleanHouse)
- [LaraDock Dial Tone](#InstallLaraDockDialTone)
- [hosts](#AddToHosts)
- [Firewall](#FireWall)
- [Enable xDebug on php-fpm](#enablePhpXdebug)
- [PHPStorm Settings](#InstallPHPStorm)
- [Configs](#InstallPHPStormConfigs)
- [Usage](#Usage)
- [Laravel](#UsageLaravel)
- [Run ExampleTest](#UsagePHPStormRunExampleTest)
- [Debug ExampleTest](#UsagePHPStormDebugExampleTest)
- [Debug Web Site](#UsagePHPStormDebugSite)
- [SSH into workspace](#SSHintoWorkspace)
- [KiTTY](#InstallKiTTY)
<a name="Intro"></a>
## Intro
Wiring up [Laravel](https://laravel.com/), [LaraDock](https://github.com/LaraDock/laradock) [Laravel+Docker] and [PHPStorm](https://www.jetbrains.com/phpstorm/) to play nice together complete with remote xdebug'ing as icing on top! Although this guide is based on `PHPStorm Windows`,
you should be able to adjust accordingly. This guide was written based on Docker for Windows Native.
<a name="Installation"></a>
## Installation
- This guide assumes the following:
- you have already installed and are familiar with Laravel, LaraDock and PHPStorm.
- you have installed Laravel as a parent of `laradock`. This guide assumes `/c/_dk/laravel`.
<a name="AddToHosts"></a>
## hosts
- Add `laravel` to your hosts file located on Windows 10 at `C:\Windows\System32\drivers\etc\hosts`. It should be set to the IP of your running container. Mine is: `10.0.75.2`
On Windows you can find it by opening Windows `Hyper-V Manager`.
- ![Windows Hyper-V Manager](photos/PHPStorm/Settings/WindowsHyperVManager.png)
- [Hosts File Editor](https://github.com/scottlerch/HostsFileEditor) makes it easy to change your hosts file.
- Set `laravel` to your docker host IP. See [Example](photos/SimpleHostsEditor/AddHost_laravel.png).
<a name="FireWall"></a>
## Firewall
Your PHPStorm will need to be able to receive a connection from PHP xdebug either your running workspace or php-fpm containers on port 9000. This means that your Windows Firewall should either enable connections from the Application PHPStorm OR the port.
- It is important to note that if the Application PHPStorm is NOT enabled in the firewall, you will not be able to recreate a rule to override that.
- Also be aware that if you are installing/upgrade different versions of PHPStorm, you MAY have orphaned references to PHPStorm in your Firewall! You may decide to remove orphaned references however in either case, make sure that they are set to receive public TCP traffic.
### Edit laradock/docker-compose.yml
Set the following variables:
```
### Workspace Utilities Container ###########################
workspace:
build:
context: ./workspace
args:
- INSTALL_XDEBUG=true
- INSTALL_WORKSPACE_SSH=true
...
### PHP-FPM Container #######################################
php-fpm:
build:
context: ./php-fpm
args:
- INSTALL_XDEBUG=true
...
```
### Edit xdebug.ini files
- `laradock/workspace/xdebug.ini`
- `laradock/php-fpm/xdebug.ini`
Set the following variables:
```
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.cli_color=1
```
<a name="InstallCleanHouse"></a>
### Need to clean house first?
Make sure you are starting with a clean state. For example, do you have other LaraDock containers and images?
Here are a few things I use to clean things up.
- Delete all containers using `grep laradock_` on the names, see: [Remove all containers based on docker image name](https://linuxconfig.org/remove-all-containners-based-on-docker-image-name).
`docker ps -a | awk '{ print $1,$2 }' | grep laradock_ | awk '{print $1}' | xargs -I {} docker rm {}`
- Delete all images containing `laradock`.
`docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}`
**Note:** This will only delete images that were built with `LaraDock`, **NOT** `laradock/*` which are pulled down by `LaraDock` such as `laradock/workspace`, etc.
**Note:** Some may fail with:
`Error response from daemon: conflict: unable to delete 3f38eaed93df (cannot be forced) - image has dependent child images`
- I added this to my `.bashrc` to remove orphaned images.
```
dclean() {
processes=`docker ps -q -f status=exited`
if [ -n "$processes" ]; thend
docker rm $processes
fi
images=`docker images -q -f dangling=true`
if [ -n "$images" ]; then
docker rmi $images
fi
}
```
- If you frequently switch configurations for LaraDock, you may find that adding the following and added to your `.bashrc` or equivalent useful:
```
# remove laravel* containers
# remove laravel_* images
dcleanlaradockfunction()
{
echo 'Removing ALL containers associated with laradock'
docker ps -a | awk '{ print $1,$2 }' | grep laradock | awk '{print $1}' | xargs -I {} docker rm {}
# remove ALL images associated with laradock_
# does NOT delete laradock/* which are hub images
echo 'Removing ALL images associated with laradock_'
docker images | awk '{print $1,$2,$3}' | grep laradock_ | awk '{print $3}' | xargs -I {} docker rmi {}
echo 'Listing all laradock docker hub images...'
docker images | grep laradock
echo 'dcleanlaradock completed'
}
# associate the above function with an alias
# so can recall/lookup by typing 'alias'
alias dcleanlaradock=dcleanlaradockfunction
```
<a name="InstallLaraDockDialTone"></a>
#### Let's get a dial-tone with Laravel
```
# barebones at this point
docker-compose up -d nginx mysql
# run
docker-compose ps
# Should see:
Name Command State Ports
-----------------------------------------------------------------------------------------------------------
laradock_mysql_1 docker-entrypoint.sh mysqld Up 0.0.0.0:3306->3306/tcp
laradock_nginx_1 nginx Up 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
laradock_php-fpm_1 php-fpm Up 9000/tcp
laradock_volumes_data_1 true Exit 0
laradock_volumes_source_1 true Exit 0
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
```
<a name="enablePhpXdebug"></a>
#### Enable xDebug on php-fpm
In a host terminal sitting in the laradock folder, run: `./xdebugPhpFpm status`
You should see something like the following:
```
xDebug status
laradock_php-fpm_1
PHP 7.0.9 (cli) (built: Aug 10 2016 19:45:48) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
```
Other commands include `./xdebugPhpFpm start | stop`.
If you have enabled `xdebug=true` in `docker-compose.yml/php-fpm`, `xdebug` will already be running when
`php-fpm` is started and listening for debug info on port 9000.
<a name="InstallPHPStormConfigs"></a>
#### PHPStorm Settings
- Here are some settings that are known to work:
- `Settings/BuildDeploymentConnection`
- ![Settings/BuildDeploymentConnection](photos/PHPStorm/Settings/BuildDeploymentConnection.png)
- `Settings/BuildDeploymentConnectionMappings`
- ![Settings/BuildDeploymentConnectionMappings](photos/PHPStorm/Settings/BuildDeploymentConnectionMappings.png)
- `Settings/BuildDeploymentDebugger`
- ![Settings/BuildDeploymentDebugger](photos/PHPStorm/Settings/BuildDeploymentDebugger.png)
- `Settings/EditRunConfigurationRemoteWebDebug`
- ![Settings/EditRunConfigurationRemoteWebDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
- `Settings/EditRunConfigurationRemoteExampleTestDebug`
- ![Settings/EditRunConfigurationRemoteExampleTestDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
- `Settings/LangsPHPDebug`
- ![Settings/LangsPHPDebug](photos/PHPStorm/Settings/LangsPHPDebug.png)
- `Settings/LangsPHPInterpreters`
- ![Settings/LangsPHPInterpreters](photos/PHPStorm/Settings/LangsPHPInterpreters.png)
- `Settings/LangsPHPPHPUnit`
- ![Settings/LangsPHPPHPUnit](photos/PHPStorm/Settings/LangsPHPPHPUnit.png)
- `Settings/LangsPHPServers`
- ![Settings/LangsPHPServers](photos/PHPStorm/Settings/LangsPHPServers.png)
- `RemoteHost`
To switch on this view, go to: `Menu/Tools/Deployment/Browse Remote Host`.
- ![RemoteHost](photos/PHPStorm/RemoteHost.png)
- `RemoteWebDebug`
- ![DebugRemoteOn](photos/PHPStorm/DebugRemoteOn.png)
- `EditRunConfigurationRemoteWebDebug`
Go to: `Menu/Run/Edit Configurations`.
- ![EditRunConfigurationRemoteWebDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteWebDebug.png)
- `EditRunConfigurationRemoteExampleTestDebug`
Go to: `Menu/Run/Edit Configurations`.
- ![EditRunConfigurationRemoteExampleTestDebug](photos/PHPStorm/Settings/EditRunConfigurationRemoteExampleTestDebug.png)
- `WindowsFirewallAllowedApps`
Go to: `Control Panel\All Control Panel Items\Windows Firewall\Allowed apps`.
- ![WindowsFirewallAllowedApps.png](photos/PHPStorm/Settings/WindowsFirewallAllowedApps.png)
- `hosts`
Edit: `C:\Windows\System32\drivers\etc\hosts`.
- ![WindowsFirewallAllowedApps.png](photos/PHPStorm/Settings/hosts.png)
- [Enable xDebug on php-fpm](#enablePhpXdebug)
<a name="Usage"></a>
## Usage
<a name="UsagePHPStormRunExampleTest"></a>
### Run ExampleTest
- right-click on `tests/ExampleTest.php`
- Select: `Run 'ExampleTest.php'` or `Ctrl+Shift+F10`.
- Should pass!! You just ran a remote test via SSH!
<a name="UsagePHPStormDebugExampleTest"></a>
### Debug ExampleTest
- Open to edit: `tests/ExampleTest.php`
- Add a BreakPoint on line 16: `$this->visit('/')`
- right-click on `tests/ExampleTest.php`
- Select: `Debug 'ExampleTest.php'`.
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
- ![Remote Test Debugging Success](photos/PHPStorm/RemoteTestDebuggingSuccess.png)
<a name="UsagePHPStormDebugSite"></a>
### Debug WebSite
- In case xDebug is disabled, from the `laradock` folder run:
`./xdebugPhpFpm start`.
- To switch xdebug off, run:
`./xdebugPhpFpm stop`
- Start Remote Debugging
- ![DebugRemoteOn](photos/PHPStorm/DebugRemoteOn.png)
- Open to edit: `bootstrap/app.php`
- Add a BreakPoint on line 14: `$app = new Illuminate\Foundation\Application(`
- Reload [Laravel Site](http://laravel/)
- Should have stopped at the BreakPoint!! You are now debugging locally against a remote Laravel project via SSH!
- ![Remote Debugging Success](photos/PHPStorm/RemoteDebuggingSuccess.png)
<a name="SSHintoWorkspace"></a>
#### Let's shell into workspace
Assuming that you are in laradock folder, type:
`ssh -i workspace/insecure_id_rsa -p2222 root@laravel`
**Cha Ching!!!!**
- `workspace/insecure_id_rsa.ppk` may become corrupted. In which case:
- fire up `puttygen`
- import `workspace/insecure_id_rsa`
- save private key to `workspace/insecure_id_rsa.ppk`
<a name="InstallKiTTY"></a>
##### KiTTY
[Kitty](http://www.9bis.net/kitty/) KiTTY is a fork from version 0.67 of PuTTY.
- Here are some settings that are working for me:
- ![Session](photos/KiTTY/Session.png)
- ![Terminal](photos/KiTTY/Terminal.png)
- ![Window](photos/KiTTY/Window.png)
- ![WindowAppearance](photos/KiTTY/WindowAppearance.png)
- ![Connection](photos/KiTTY/Connection.png)
- ![ConnectionData](photos/KiTTY/ConnectionData.png)
- ![ConnectionSSH](photos/KiTTY/ConnectionSSH.png)
- ![ConnectionSSHAuth](photos/KiTTY/ConnectionSSHAuth.png)
- ![TerminalShell](photos/KiTTY/TerminalShell.png)

View File

@ -2,15 +2,15 @@ FROM webdevops/apache:ubuntu-16.04
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com> MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
ARG PHP_SOCKET="php-fpm:9000" ARG PHP_SOCKET=php-fpm:9000
ENV WEB_PHP_SOCKET=$PHP_SOCKET ENV WEB_PHP_SOCKET=$PHP_SOCKET
ENV WEB_DOCUMENT_ROOT=/var/www/laravel/public ENV WEB_DOCUMENT_ROOT=/var/www/public
EXPOSE 80 443 EXPOSE 80 443
WORKDIR /var/www/laravel/public WORKDIR /var/www/public
ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"] ENTRYPOINT ["/opt/docker/bin/entrypoint.sh"]

View File

@ -1,6 +1,6 @@
# Docs: https://caddyserver.com/docs/caddyfile # Docs: https://caddyserver.com/docs/caddyfile
0.0.0.0:80 0.0.0.0:80
root /var/www/laravel/public root /var/www/public
fastcgi / php-fpm:9000 php { fastcgi / php-fpm:9000 php {
index index.php index index.php
} }

View File

@ -2,7 +2,7 @@ FROM alpine:3.4
MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com> MAINTAINER Eric Pfeiffer <computerfr33k@users.noreply.github.com>
ENV caddy_version=0.9.1 ENV caddy_version=0.9.3
LABEL caddy_version="$caddy_version" architecture="amd64" LABEL caddy_version="$caddy_version" architecture="amd64"
@ -11,14 +11,14 @@ RUN apk update \
&& apk add tar curl && apk add tar curl
RUN curl --silent --show-error --fail --location \ RUN curl --silent --show-error --fail --location \
--header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \ --header "Accept: application/tar+gzip, application/x-gzip, application/octet-stream" -o - \
"https://github.com/mholt/caddy/releases/download/v$caddy_version/caddy_linux_amd64.tar.gz" \ "https://github.com/mholt/caddy/releases/download/v$caddy_version/caddy_linux_amd64.tar.gz" \
| tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \ | tar --no-same-owner -C /usr/bin/ -xz caddy_linux_amd64 \
&& mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \ && mv /usr/bin/caddy_linux_amd64 /usr/bin/caddy \
&& chmod 0755 /usr/bin/caddy && chmod 0755 /usr/bin/caddy
EXPOSE 80 443 2015 EXPOSE 80 443 2015
WORKDIR /var/www/laravel/public WORKDIR /var/www/public
CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"] CMD ["/usr/bin/caddy", "-conf", "/etc/Caddyfile"]

View File

@ -2,6 +2,14 @@ version: '2'
services: services:
### Applications Code Container #############################
applications:
image: tianon/true
volumes:
- ../:/var/www
# - ../sample/:/var/www/sample
### Workspace Utilities Container ########################### ### Workspace Utilities Container ###########################
workspace: workspace:
@ -11,6 +19,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,13 +27,14 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- NODE_VERSION=stable - NODE_VERSION=stable
- TZ=UTC
volumes_from: volumes_from:
- volumes_source - applications
extra_hosts: extra_hosts:
# IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts) # IMPORTANT: Replace with your Docker Host IP (will be appended to /etc/hosts)
- "dockerhost:10.0.75.1" - "dockerhost:10.0.75.1"
ports: ports:
- "22:22" - "2222:22"
tty: true tty: true
### PHP-FPM Container ####################################### ### PHP-FPM Container #######################################
@ -39,9 +49,10 @@ services:
- INSTALL_MEMCACHED=false - INSTALL_MEMCACHED=false
- INSTALL_OPCACHE=false - INSTALL_OPCACHE=false
- INSTALL_AEROSPIKE_EXTENSION=false - INSTALL_AEROSPIKE_EXTENSION=false
- CODEIGNITER=false
dockerfile: Dockerfile-70 dockerfile: Dockerfile-70
volumes_from: volumes_from:
- volumes_source - applications
expose: expose:
- "9000" - "9000"
links: links:
@ -51,7 +62,7 @@ services:
- "dockerhost:10.0.75.1" - "dockerhost:10.0.75.1"
environment: environment:
# IMPORTANT: Set the Remote Interpreter entry matching name to `laravel` # IMPORTANT: Set the Remote Interpreter entry matching name to `laravel`
- PHP_IDE_CONFIG="serverName=laravel" - PHP_IDE_CONFIG=serverName=laravel
### Nginx Server Container ################################## ### Nginx Server Container ##################################
@ -61,24 +72,25 @@ services:
args: args:
- PHP_UPSTREAM=php-fpm - PHP_UPSTREAM=php-fpm
volumes_from: volumes_from:
- volumes_source - applications
volumes: volumes:
- ./logs/nginx/:/var/log/nginx - ./logs/nginx/:/var/log/nginx
- ./nginx/sites/:/etc/nginx/sites-available
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
links: links:
- php-fpm - php-fpm
### Apache Server Container ################################## ### Apache Server Container #################################
apache2: apache2:
build: build:
context: ./apache2 context: ./apache2
args: args:
- PHP_SOCKET="php-fpm:9000" - PHP_SOCKET=php-fpm:9000
volumes_from: volumes_from:
- volumes_source - applications
volumes: volumes:
- ./logs/apache2:/var/log/apache2 - ./logs/apache2:/var/log/apache2
ports: ports:
@ -92,7 +104,7 @@ services:
hhvm: hhvm:
build: ./hhvm build: ./hhvm
volumes_from: volumes_from:
- volumes_source - applications
expose: expose:
- "9000" - "9000"
links: links:
@ -101,9 +113,24 @@ services:
### MySQL Container ######################################### ### MySQL Container #########################################
mysql: mysql:
build: ./mysql build:
volumes_from: context: ./mysql
- volumes_data args:
- MYSQL_DATABASE=homestead
- MYSQL_USER=homestead
- MYSQL_PASSWORD=secret
- MYSQL_ROOT_PASSWORD=root
volumes:
- mysql:/var/lib/mysql
ports:
- "3306:3306"
### MariaDB Container #######################################
mariadb:
build: ./mariadb
volumes:
- mysql:/var/lib/mysql
ports: ports:
- "3306:3306" - "3306:3306"
environment: environment:
@ -116,8 +143,8 @@ services:
postgres: postgres:
build: ./postgres build: ./postgres
volumes_from: volumes:
- volumes_data - postgres:/var/lib/postgresql/data
ports: ports:
- "5432:5432" - "5432:5432"
environment: environment:
@ -125,19 +152,18 @@ services:
POSTGRES_USER: homestead POSTGRES_USER: homestead
POSTGRES_PASSWORD: secret POSTGRES_PASSWORD: secret
### MariaDB Container ####################################### ### PostgreSQL PostGis Container ############################
mariadb: postgres-postgis:
build: ./mariadb build: ./postgres-postgis
volumes_from: volumes:
- volumes_data - postgres:/var/lib/postgresql/data
ports: ports:
- "3306:3306" - "5432:5432"
environment: environment:
MYSQL_DATABASE: homestead POSTGRES_DB: homestead
MYSQL_USER: homestead POSTGRES_USER: homestead
MYSQL_PASSWORD: secret POSTGRES_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
### Neo4j Container ######################################### ### Neo4j Container #########################################
@ -148,8 +174,8 @@ services:
- "1337:1337" - "1337:1337"
environment: environment:
- NEO4J_AUTH=homestead:secret - NEO4J_AUTH=homestead:secret
volumes_from: volumes:
- volumes_data - neo4j:/var/lib/neo4j/data
### MongoDB Container ####################################### ### MongoDB Container #######################################
@ -157,38 +183,39 @@ services:
build: ./mongo build: ./mongo
ports: ports:
- "27017:27017" - "27017:27017"
volumes_from: volumes:
- volumes_data - mongo:/data/db
### Redis Container ######################################### ### Redis Container #########################################
redis: redis:
build: ./redis build: ./redis
volumes_from: volumes:
- volumes_data - redis:/data
ports: ports:
- "6379:6379" - "6379:6379"
### Aerospike c Container ######################################### ### Aerospike c Container ###################################
aerospike: aerospike:
build: ./aerospike build: ./aerospike
volumes_from: volumes_from:
- workspace - workspace
- volumes_data volumes:
- aerospike:/opt/aerospike/data
ports: ports:
- "3000:3000" - "3000:3000"
- "3001:3001" - "3001:3001"
- "3002:3002" - "3002:3002"
- "3003:3003" - "3003:3003"
### Memcached Container ##################################### ### Memcached Container #####################################
memcached: memcached:
build: ./memcached build: ./memcached
volumes_from: volumes:
- volumes_data - memcached:/var/lib/memcached
ports: ports:
- "11211:11211" - "11211:11211"
links: links:
@ -204,7 +231,7 @@ services:
links: links:
- php-fpm - php-fpm
### RabbitMQ Container #################################### ### RabbitMQ Container ######################################
rabbitmq: rabbitmq:
build: ./rabbitmq build: ./rabbitmq
@ -233,7 +260,9 @@ services:
caddy: caddy:
build: ./caddy build: ./caddy
volumes_from: volumes_from:
- volumes_source - applications
volumes:
- caddy:/root/.caddy
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
@ -244,7 +273,7 @@ services:
links: links:
- php-fpm - php-fpm
### phpMyAdmin Container ################################## ### phpMyAdmin Container ####################################
phpmyadmin: phpmyadmin:
build: ./phpmyadmin build: ./phpmyadmin
@ -253,8 +282,6 @@ services:
MYSQL_USER: homestead MYSQL_USER: homestead
MYSQL_PASSWORD: secret MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root MYSQL_ROOT_PASSWORD: root
volumes_from:
- volumes_data
ports: ports:
- "8080:80" - "8080:80"
links: links:
@ -263,7 +290,7 @@ services:
# for mariadb container # for mariadb container
# - "mariadb:db" # - "mariadb:db"
### pgAdmin Container ################################## ### pgAdmin Container #######################################
pgadmin: pgadmin:
build: ./pgadmin build: ./pgadmin
@ -272,28 +299,45 @@ services:
links: links:
- postgres - postgres
### Laravel Application Code Container ###################### ### ElasticSearch Container #################################
volumes_source: elasticsearch:
image: tianon/true build: ./elasticsearch
volumes: volumes:
- ../:/var/www/laravel - elasticsearch-data:/usr/share/elasticsearch/data
# Demonstration of how to mount multiple sites - elasticsearch-pkugins:/usr/share/elasticsearch/data
# - ../../site_a/:/var/www/site_a ports:
# - ../../site_b/:/var/www/site_b - "9200:9200"
- "9300:9300"
links:
- php-fpm
### Databases Data Container ################################ ### Volumes Setup ###########################################
volumes_data: volumes:
image: tianon/true mysql:
volumes: driver: "local"
- ./data/mysql:/var/lib/mysql postgres:
- ./data/postgres:/var/lib/postgresql/data driver: "local"
- ./data/memcached:/var/lib/memcached memcached:
- ./data/redis:/data driver: "local"
- ./data/neo4j:/var/lib/neo4j/data redis:
- ./data/mongo:/data/db driver: "local"
- ./data/aerospike:/opt/aerospike/data neo4j:
- ./data/sessions:/sessions driver: "local"
mariadb:
### Add more Containers below ############################### driver: "local"
mongo:
driver: "local"
phpmyadmin:
driver: "local"
aerospike:
driver: "local"
caddy:
driver: "local"
elasticsearch-data:
driver: "local"
elasticsearch-pkugins:
driver: "local"
sessions: ## nothing is connected to this (- ./data/sessions:/sessions)
driver: "local"

5
elasticsearch/Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM elasticsearch:latest
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
EXPOSE 9200 9300

View File

@ -1,4 +1,4 @@
FROM ubuntu:14.04 FROM ubuntu:14.04
RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449 RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
@ -10,13 +10,13 @@ RUN apt-get update -y \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/www/laravel RUN mkdir -p /var/www
ADD server.ini /etc/hhvm/server.ini ADD server.ini /etc/hhvm/server.ini
RUN usermod -u 1000 www-data RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel WORKDIR /var/www
CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"] CMD ["/usr/bin/hhvm", "-m", "server", "-c", "/etc/hhvm/server.ini"]

View File

@ -12,7 +12,7 @@ hhvm.log.level = Error
hhvm.log.header = true hhvm.log.header = true
hhvm.log.access[default][file] = /var/log/hhvm/access.log hhvm.log.access[default][file] = /var/log/hhvm/access.log
hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b" hhvm.log.access[default][format] = "%h %l %u %t \"%r\" %>s %b"
hhvm.server.source_root=/var/www/laravel/public hhvm.server.source_root=/var/www/public
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc
; Uncomment to log to files instead of STDOUT ; Uncomment to log to files instead of STDOUT

View File

@ -1,7 +1,27 @@
FROM mysql:latest FROM mysql:5.7
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
CMD ["mysqld"] ADD startup /etc/mysql/startup
RUN chown -R mysql:root /var/lib/mysql/
ARG MYSQL_DATABASE=homestead
ARG MYSQL_USER=homestead
ARG MYSQL_PASSWORD=secret
ARG MYSQL_ROOT_PASSWORD=root
ENV MYSQL_DATABASE=$MYSQL_DATABASE
ENV MYSQL_USER=$MYSQL_USER
ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
ENV MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
RUN sed -i 's/MYSQL_DATABASE/'$MYSQL_DATABASE'/g' /etc/mysql/startup && \
sed -i 's/MYSQL_USER/'$MYSQL_USER'/g' /etc/mysql/startup && \
sed -i 's/MYSQL_PASSWORD/'$MYSQL_PASSWORD'/g' /etc/mysql/startup
ADD my.cnf /etc/mysql/conf.d/my.cnf
CMD ["mysqld", "--init-file=/etc/mysql/startup"]
EXPOSE 3306 EXPOSE 3306

9
mysql/my.cnf Normal file
View File

@ -0,0 +1,9 @@
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

4
mysql/startup Normal file
View File

@ -0,0 +1,4 @@
DROP USER IF EXISTS 'MYSQL_USER';
CREATE USER 'MYSQL_USER'@'%';
CREATE DATABASE IF NOT EXISTS MYSQL_DATABASE;
GRANT ALL ON MYSQL_DATABASE.* TO 'MYSQL_USER'@'%' IDENTIFIED BY 'MYSQL_PASSWORD';

View File

@ -3,7 +3,6 @@ FROM nginx:alpine
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
ADD nginx.conf /etc/nginx/ ADD nginx.conf /etc/nginx/
COPY sites/*.conf /etc/nginx/sites-available/
ARG PHP_UPSTREAM=php-fpm ARG PHP_UPSTREAM=php-fpm

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;
} }

2
nginx/sites/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.conf
!default.conf

View File

@ -3,8 +3,8 @@ server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server ipv6only=on; listen [::]:80 default_server ipv6only=on;
server_name laravel; server_name laradock;
root /var/www/laravel/public; root /var/www/public;
index index.php index.html index.htm; index index.php index.html index.htm;
location / { location / {

View File

@ -1,57 +0,0 @@
server {
listen 80;
listen [::]:80;
#domain name
server_name drupal8.dev;
#file document root. This has to match one of the volumes in docer-composer.yml
root /var/www/drupal8;
# This is the full path to your index file
index index.php index.html index.htm;
## serve imagecache files directly or redirect to drupal if they do not exist.
location ~* files/styles {
access_log off;
expires 30d;
try_files $uri @drupal;
}
## serve imagecache files directly or redirect to drupal if they do not exist.
location ~* ^.+.(xsl|xml)$ {
access_log off;
expires 1d;
try_files $uri @drupal;
}
## Images and static content is treated different
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
access_log off;
expires 30d;
}
location / {
index index.php;
# This is cool because no php is touched for static content
try_files $uri $uri/ @rewrite;
expires max;
}
location @drupal {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
location @rewrite {
# Some modules enforce no slash (/) at the end of the URL
# Else this rewrite block wouldn&#39;t be needed (GlobalRedirect)
rewrite ^/(.*)$ /index.php?q=$1;
}
location ~ .php$ {
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

View File

@ -3,8 +3,8 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name site_a; server_name sample.dev;
root /var/www/site_a/public; root /var/www/sample/public;
index index.php index.html index.htm; index index.php index.html index.htm;
location / { location / {

View File

@ -1,28 +0,0 @@
server {
listen 80;
listen [::]:80;
server_name site_b;
root /var/www/site_b/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass php-upstream;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}

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,12 +108,27 @@ 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 \
;fi ;fi
# Copy opcache configration
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
#####################################
# Codeigniter Modifications:
#####################################
ARG CODEIGNITER=false
RUN if [ ${CODEIGNITER} = true ]; then \
# Install Codeigniter PHP extentions requirements
docker-php-ext-install mysqli && \
docker-php-ext-install tokenizer \
;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Final Touch # Final Touch
@ -127,7 +142,7 @@ RUN rm -r /var/lib/apt/lists/*
RUN usermod -u 1000 www-data RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel WORKDIR /var/www
CMD ["php-fpm"] CMD ["php-fpm"]

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,13 +120,25 @@ 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 \
;fi ;fi
# Copy opcache configration
COPY ./opcache.ini /usr/local/etc/php/conf.d/opcache.ini
#####################################
# Codeigniter Modifications:
#####################################
ARG CODEIGNITER=false
RUN if [ ${CODEIGNITER} = true ]; then \
# Install Codeigniter PHP extentions requirements
docker-php-ext-install mysqli && \
docker-php-ext-install tokenizer \
;fi
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
@ -140,8 +153,8 @@ RUN rm -r /var/lib/apt/lists/*
RUN usermod -u 1000 www-data RUN usermod -u 1000 www-data
WORKDIR /var/www/laravel WORKDIR /var/www
CMD ["php-fpm"] CMD ["php-fpm"]
EXPOSE 9000 EXPOSE 9000

7
php-fpm/opcache.ini Normal file
View File

@ -0,0 +1,7 @@
extension=opcache.so
opcache.enable="1"
opcache.memory_consumption="256"
opcache.use_cwd="0"
opcache.fast_shutdown="1"
opcache.max_file_size="0"
opcache.validate_timestamps="0"

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,5 @@
FROM mdillon/postgis:latest
CMD ["postgres"]
EXPOSE 5432

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
### Application Code Container ######################
volumes_source:
image: tianon/true
volumes:
- ../:/var/www
### Databases Data Container ################################
volumes_data:
image: tianon/true
volumes:
# - ./data/mysql:/var/lib/mysql
### Add All your Software Containers below ###############################

View File

@ -1,12 +1,5 @@
#
# RabbitMQ Dockerfile
#
# https://github.com/dockerfile/rabbitmq
#
# Pull base image.
FROM rabbitmq FROM rabbitmq
RUN rabbitmq-plugins enable --offline rabbitmq_management RUN rabbitmq-plugins enable --offline rabbitmq_management
EXPOSE 15671 15672 EXPOSE 15671 15672

View File

@ -10,7 +10,7 @@
# https://hub.docker.com/r/laradock/workspace/tags/ # https://hub.docker.com/r/laradock/workspace/tags/
# #
FROM laradock/workspace:1.1 FROM laradock/workspace:1.2
MAINTAINER Mahmoud Zalt <mahmoud@zalt.me> MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
@ -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:
@ -101,6 +46,14 @@ ARG PUID=1000
ARG PGID=1000 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/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} && \
@ -165,14 +172,51 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
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
# Add NVM binaries to root's .bashrc
USER root
RUN if [ ${INSTALL_NODE} = true ]; then \
echo "" >> ~/.bashrc && \
echo 'export NVM_DIR="/home/laradock/.nvm"' >> ~/.bashrc && \
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
;fi
#####################################
# YARN:
#####################################
USER laradock
ARG INSTALL_YARN=false
ENV INSTALL_YARN ${INSTALL_YARN}
RUN if [ ${INSTALL_YARN} = true ]; then \
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
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" \
@ -187,6 +231,20 @@ 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 \
rm /etc/php/7.0/cli/conf.d/aerospike.ini \
;fi
#####################################
# Non-root user : PHPUnit path
#####################################
# add ./vendor/bin to non-root user's bashrc (needed for phpunit)
USER laradock
RUN echo "" >> ~/.bashrc && \
echo 'export PATH="/var/www/vendor/bin:$PATH"' >> ~/.bashrc
# #
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Final Touch # Final Touch
@ -199,4 +257,4 @@ RUN apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set default work directory # Set default work directory
WORKDIR /var/www/laravel WORKDIR /var/www

1
workspace/crontab/root Normal file
View File

@ -0,0 +1 @@
* * * * * php /var/www/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