Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
1d8336a9e1 | |||
f0e2d83618 | |||
7f1deb0342 | |||
703887a2a6 | |||
84e6b2b6ff | |||
c3ff9e485b | |||
77f9183c83 | |||
378181044c | |||
01bdaae690 |
403
README.md
403
README.md
@ -16,31 +16,36 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
|
|||||||
|
|
||||||
- [Intro](#Intro)
|
- [Intro](#Intro)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
|
- [Supported Containers](#Supported-Containers)
|
||||||
- [What is Docker](#what-is-docker)
|
- [What is Docker](#what-is-docker)
|
||||||
- [What is Laravel](#what-is-laravel)
|
- [What is Laravel](#what-is-laravel)
|
||||||
- [Why Docker not Vagrant](#why-docker-not-vagrant)
|
- [Why Docker not Vagrant](#why-docker-not-vagrant)
|
||||||
- [LaraDock VS Homestead](#laradock-vs-homestead)
|
- [LaraDock VS Homestead](#laradock-vs-homestead)
|
||||||
- [Supported Containers](#Supported-Containers)
|
|
||||||
- [Requirements](#Requirements)
|
- [Requirements](#Requirements)
|
||||||
- [Installation](#Installation)
|
- [Installation](#Installation)
|
||||||
- [Usage](#Usage)
|
- [Usage](#Usage)
|
||||||
- [Documentation](#Documentation)
|
- [Documentation](#Documentation)
|
||||||
|
- [Docker](#Docker)
|
||||||
- [List current running Containers](#List-current-running-Containers)
|
- [List current running Containers](#List-current-running-Containers)
|
||||||
- [Close all running Containers](#Close-all-running-Containers)
|
- [Close all running Containers](#Close-all-running-Containers)
|
||||||
- [Delete all existing Containers](#Delete-all-existing-Containers)
|
- [Delete all existing Containers](#Delete-all-existing-Containers)
|
||||||
- [Build/Re-build Containers](#Build-Re-build-Containers)
|
|
||||||
- [Change the PHP Version](#Change-the-PHP-Version)
|
|
||||||
- [Add/Remove a Docker Container](#AddRemove-a-Docker-Container)
|
|
||||||
- [Add more Software's (Docker Images)](#Add-Docker-Images)
|
|
||||||
- [Edit default container configuration](#Edit-Container)
|
|
||||||
- [Use custom Domain](Use-custom-Domain)
|
|
||||||
- [View the Log files](#View-the-Log-files)
|
|
||||||
- [Use Redis](#Use-Redis)
|
|
||||||
- [Enter a Container (SSH into a running Container)](#Enter-Container)
|
- [Enter a Container (SSH into a running Container)](#Enter-Container)
|
||||||
|
- [Edit default container configuration](#Edit-Container)
|
||||||
- [Edit a Docker Image](#Edit-a-Docker-Image)
|
- [Edit a Docker Image](#Edit-a-Docker-Image)
|
||||||
|
- [Build/Re-build Containers](#Build-Re-build-Containers)
|
||||||
|
- [Add more Software's (Docker Images)](#Add-Docker-Images)
|
||||||
|
- [View the Log files](#View-the-Log-files)
|
||||||
|
- [Laravel](#Laravel):
|
||||||
|
- [Run Artisan Commands](#Run-Artisan-Commands)
|
||||||
|
- [Use Redis](#Use-Redis)
|
||||||
|
- [PHP](#PHP)
|
||||||
|
- [Install PHP Extensions](#Install-PHP-Extensions)
|
||||||
|
- [Change the PHP-FPM Version](#Change-the-PHP-FPM-Version)
|
||||||
|
- [Change the PHP-CLI Version](#Change-the-PHP-CLI-Version)
|
||||||
|
- [Misc](#Misc)
|
||||||
- [Run a Docker Virtual Host](#Run-Docker-Virtual-Host)
|
- [Run a Docker Virtual Host](#Run-Docker-Virtual-Host)
|
||||||
- [Find your Docker IP Address](#Find-Docker-IP-Address)
|
- [Find your Docker IP Address](#Find-Docker-IP-Address)
|
||||||
|
- [Use custom Domain](#Use-custom-Domain)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +81,7 @@ docker-compose up nginx mysql
|
|||||||
|
|
||||||
|
|
||||||
<a name="Supported-Containers"></a>
|
<a name="Supported-Containers"></a>
|
||||||
## Supported Containers
|
### Supported Containers
|
||||||
|
|
||||||
- PHP-FPM (7.0 - 5.6 - 5.5)
|
- PHP-FPM (7.0 - 5.6 - 5.5)
|
||||||
- NGINX
|
- NGINX
|
||||||
@ -87,7 +92,7 @@ docker-compose up nginx mysql
|
|||||||
- Memcached
|
- Memcached
|
||||||
- Beanstalkd
|
- Beanstalkd
|
||||||
- Beanstalkd Console
|
- Beanstalkd Console
|
||||||
- Workspace (includes: Composer, PHP7-CLI, Laravel Installer, Git, Vim, Nano and cURL)
|
- Workspace (contains: Composer, PHP7-CLI, Laravel Installer, Git, Node, Gulp, Bower, Vim, Nano and cURL)
|
||||||
- Data Volume *(Databases Data Container)*
|
- Data Volume *(Databases Data Container)*
|
||||||
- Application *(Application Code Container)*
|
- Application *(Application Code Container)*
|
||||||
|
|
||||||
@ -162,6 +167,7 @@ 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`.*
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
#### B - From scratch (Install LaraDock and Laravel):
|
#### B - From scratch (Install LaraDock and Laravel):
|
||||||
|
|
||||||
*If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.*
|
*If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.*
|
||||||
@ -262,6 +268,13 @@ sudo chmod -R 777 storage && sudo chmod -R 777 bootstrap/cache
|
|||||||
<a name="Documentation"></a>
|
<a name="Documentation"></a>
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="Docker"></a>
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="List-current-running-Containers"></a>
|
<a name="List-current-running-Containers"></a>
|
||||||
#### List current running Containers
|
#### List current running Containers
|
||||||
```bash
|
```bash
|
||||||
@ -274,6 +287,9 @@ docker-compose ps
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Close-all-running-Containers"></a>
|
<a name="Close-all-running-Containers"></a>
|
||||||
#### Close all running Containers
|
#### Close all running Containers
|
||||||
@ -289,6 +305,9 @@ docker-compose stop {container-name}
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Delete-all-existing-Containers"></a>
|
<a name="Delete-all-existing-Containers"></a>
|
||||||
#### Delete all existing Containers
|
#### Delete all existing Containers
|
||||||
@ -301,69 +320,25 @@ docker-compose down
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<a name="Build-Re-build-Containers"></a>
|
|
||||||
#### Build/Re-build Containers
|
|
||||||
|
|
||||||
If you do any change to any `dockerfile` make sure you run this command, for the changes to take effect:
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Enter-Container"></a>
|
||||||
|
#### Enter a Container (SSH into a running Container)
|
||||||
|
|
||||||
|
1 - first list the current running containers with `docker ps`
|
||||||
|
|
||||||
|
2 - enter any container using:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose build
|
docker exec -it {container-name} bash
|
||||||
```
|
|
||||||
Optionally you can specify which container to rebuild (instead of rebuilding all the containers):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose build {container-name}
|
|
||||||
```
|
```
|
||||||
|
3 - to exit a container, type `exit`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<a name="Change-the-PHP-Version"></a>
|
|
||||||
#### Change the PHP Version
|
|
||||||
By default **PHP 7.0** is running.
|
|
||||||
<br>
|
|
||||||
To change the default PHP version:
|
|
||||||
|
|
||||||
1 - Open the `docker-compose.yml`.
|
|
||||||
|
|
||||||
2 - Search for `Dockerfile-70` in the PHP container section.
|
|
||||||
|
|
||||||
3 - Change the version number.
|
|
||||||
<br>
|
|
||||||
Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`.
|
|
||||||
|
|
||||||
Sample:
|
|
||||||
|
|
||||||
```txt
|
|
||||||
php-fpm:
|
|
||||||
build:
|
|
||||||
context: ./php-fpm
|
|
||||||
dockerfile: Dockerfile-70
|
|
||||||
```
|
|
||||||
|
|
||||||
Supported Versions:
|
|
||||||
|
|
||||||
- For (PHP 7.0.*) use `Dockerfile-70`
|
|
||||||
- For (PHP 5.6.*) use `Dockerfile-56`
|
|
||||||
- For (PHP 5.5.*) use `Dockerfile-55`
|
|
||||||
|
|
||||||
|
|
||||||
4 - Finally rebuild the container
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose build php
|
|
||||||
```
|
|
||||||
|
|
||||||
For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<a name="Add-Docker-Images"></a>
|
|
||||||
#### Add more Software's (Docker Images)
|
|
||||||
|
|
||||||
To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -390,35 +365,68 @@ Change Redis defaut port to 1111:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Use-custom-Domain"></a>
|
<a name="Edit-a-Docker-Image"></a>
|
||||||
#### Use custom Domain (instead of the Docker IP)
|
#### Edit a Docker Image
|
||||||
|
|
||||||
Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`.
|
1 - Find the `dockerfile` of the image you want to edit,
|
||||||
|
<br>
|
||||||
|
example for `mysql` it will be `mysql/Dockerfile`.
|
||||||
|
|
||||||
1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following:
|
2 - Edit the file the way you want.
|
||||||
|
|
||||||
|
3 - Re-build the container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
xxx.xxx.xxx.xxx laravel.dev
|
docker-compose build mysql
|
||||||
```
|
```
|
||||||
|
|
||||||
2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`.
|
*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
Example:
|
<a name="Build-Re-build-Containers"></a>
|
||||||
|
#### Build/Re-build Containers
|
||||||
|
|
||||||
```env
|
If you do any change to any `dockerfile` make sure you run this command, for the changes to take effect:
|
||||||
DB_HOST=xxx.xxx.xxx.xxx
|
|
||||||
|
```bash
|
||||||
|
docker-compose build
|
||||||
|
```
|
||||||
|
Optionally you can specify which container to rebuild (instead of rebuilding all the containers):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose build {container-name}
|
||||||
```
|
```
|
||||||
|
|
||||||
3 - Open your browser and visit `{http://laravel.dev}`
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Optionally you can define the server name in the nginx config file, like this:
|
|
||||||
|
|
||||||
```conf
|
|
||||||
server_name laravel.dev;
|
<br>
|
||||||
```
|
<a name="Add-Docker-Images"></a>
|
||||||
|
#### Add more Software's (Docker Images)
|
||||||
|
|
||||||
|
To add an image (software), just edit the `docker-compose.yml` and add your container details, to do so you need to be familiar with the [docker compose file syntax](https://docs.docker.com/compose/compose-file/).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -438,6 +446,57 @@ docker logs {container-name}
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Laravel"></a>
|
||||||
|
### Laravel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="Run-Artisan-Commands"></a>
|
||||||
|
#### Run Artisan Commands
|
||||||
|
|
||||||
|
You can run artisan commands and many other Terminal commands from the Workspace container.
|
||||||
|
|
||||||
|
1 - Make sure you have the workspace container running.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d workspace // ..and all your other containers
|
||||||
|
```
|
||||||
|
|
||||||
|
2 - Find the Workspace container name:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose ps
|
||||||
|
```
|
||||||
|
|
||||||
|
3 - Enter the Workspace container:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker exec -it {workspace-container-name} bash
|
||||||
|
```
|
||||||
|
|
||||||
|
4 - Run anything you want :)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php artisan
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
Composer update
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
phpunit
|
||||||
|
```
|
||||||
|
```bash
|
||||||
|
laravel new blog
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Use-Redis"></a>
|
<a name="Use-Redis"></a>
|
||||||
@ -487,50 +546,113 @@ composer require predis/predis:^1.0
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<a name="Enter-Container"></a>
|
|
||||||
#### Enter a Container (SSH into a running Container)
|
|
||||||
|
|
||||||
1 - first list the current running containers with `docker ps`
|
|
||||||
|
|
||||||
2 - enter any container using:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker exec -it {container-name} bash
|
|
||||||
```
|
|
||||||
3 - to exit a container, type `exit`.
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
|
||||||
<a name="AddRemove-a-Docker-Container"></a>
|
|
||||||
#### Add/Remove a Docker Container
|
|
||||||
To prevent a container (software) from running, open the `docker-compose.yml` file, and comment out the container section or remove it entirely.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Edit-a-Docker-Image"></a>
|
<a name="PHP"></a>
|
||||||
#### Edit a Docker Image
|
### PHP
|
||||||
|
|
||||||
1 - Find the `dockerfile` of the image you want to edit,
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="Install-PHP-Extensions"></a>
|
||||||
|
#### Install PHP Extensions
|
||||||
|
|
||||||
|
Before installing PHP extensions, you have to decide whether you need for the `FPM` or `CLI` because each lives on a different container, if you need it for both you have to edit both containers.
|
||||||
|
|
||||||
|
The PHP-FPM extensions should be installed in `php-fpm/Dockerfile-XX`. *(replace XX with your default PHP version number)*.
|
||||||
<br>
|
<br>
|
||||||
example for `php` it will be `docker/php/dockerfile`.
|
The PHP-CLI extensions should be installed in `workspace/Dockerfile`.
|
||||||
|
|
||||||
2 - Edit the file the way you want.
|
|
||||||
|
|
||||||
3 - Re-build the container:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose build
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Change-the-PHP-FPM-Version"></a>
|
||||||
|
#### Change the PHP-FPM Version
|
||||||
|
By default **PHP-FPM 7.0** is running.
|
||||||
|
|
||||||
|
>The PHP-FPM is responsible of serving your application code, you don't have to change the PHP-CLI version if you are planing to run your application on different PHP-FPM version.
|
||||||
|
|
||||||
|
1 - Open the `docker-compose.yml`.
|
||||||
|
|
||||||
|
2 - Search for `Dockerfile-70` in the PHP container section.
|
||||||
|
|
||||||
|
3 - Change the version number.
|
||||||
|
<br>
|
||||||
|
Example to select version 5.6 instead of 7.0 you have to replace `Dockerfile-70` with `Dockerfile-56`.
|
||||||
|
|
||||||
|
Sample:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
php-fpm:
|
||||||
|
build:
|
||||||
|
context: ./php-fpm
|
||||||
|
dockerfile: Dockerfile-70
|
||||||
```
|
```
|
||||||
|
|
||||||
*If you find any bug or you have and suggestion that can improve the performance of any image, please consider contributing. Thanks in advance.*
|
Supported Versions:
|
||||||
|
|
||||||
|
- For (PHP 7.0.*) use `Dockerfile-70`
|
||||||
|
- For (PHP 5.6.*) use `Dockerfile-56`
|
||||||
|
- For (PHP 5.5.*) use `Dockerfile-55`
|
||||||
|
|
||||||
|
|
||||||
|
4 - Finally rebuild the container
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose build php
|
||||||
|
```
|
||||||
|
|
||||||
|
For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
<a name="Change-the-PHP-CLI-Version"></a>
|
||||||
|
#### Change the PHP-CLI Version
|
||||||
|
By default **PHP-CLI 7.0** is running.
|
||||||
|
|
||||||
|
>Note: it's not very essential to edit the PHP-CLI verion. The PHP-CLI is only used for the Artisan Commands & Composer. It doesn't serve your Application code, this is the PHP-FPM job.
|
||||||
|
|
||||||
|
The PHP-CLI is installed in the Workspace container. To change the PHP-CLI version you need to edit the `workspace/Dockerfile`.
|
||||||
|
|
||||||
|
Right now you have to manually edit the `Dockerfile` or create a new one like it's done for the PHP-FPM. (consider contributing).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Misc"></a>
|
||||||
|
### Misc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="Run-Docker-Virtual-Host"></a>
|
<a name="Run-Docker-Virtual-Host"></a>
|
||||||
#### Run a Docker Virtual Host
|
#### Run a Docker Virtual Host
|
||||||
|
|
||||||
@ -556,6 +678,10 @@ eval $(docker-machine env)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<a name="Find-Docker-IP-Address"></a>
|
<a name="Find-Docker-IP-Address"></a>
|
||||||
#### Find your Docker IP Address
|
#### Find your Docker IP Address
|
||||||
@ -565,13 +691,72 @@ eval $(docker-machine env)
|
|||||||
```bash
|
```bash
|
||||||
docker-machine ip default
|
docker-machine ip default
|
||||||
```
|
```
|
||||||
|
If your Host name is different then `default`, you have to specify it (`docker-machine ip my-host`).
|
||||||
|
|
||||||
*(The default IP is 192.168.99.100)*
|
*(The default IP is 192.168.99.100)*
|
||||||
|
|
||||||
|
> **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*.
|
||||||
|
|
||||||
|
<br>
|
||||||
**On Linux:**
|
**On Linux:**
|
||||||
|
|
||||||
Your IP Address is `127.0.0.1`
|
1 - Run `ifconfig` in the terminal.
|
||||||
|
|
||||||
|
2 - In the result search for `docker0`, your IP address will be next to `inet addr`.
|
||||||
|
|
||||||
|
Example: (In this example your IP address is `172.17.0.1`).
|
||||||
|
|
||||||
|
```shell
|
||||||
|
docker0 Link encap:Ethernet HWaddr 02:42:41:2d:c4:24
|
||||||
|
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
|
||||||
|
UP BROADCAST MULTICAST MTU:1500 Metric:1
|
||||||
|
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
|
||||||
|
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
|
||||||
|
collisions:0 txqueuelen:0
|
||||||
|
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
|
||||||
|
```
|
||||||
|
>If you have an easier way to do it, share it with us.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<a name="Use-custom-Domain"></a>
|
||||||
|
#### Use custom Domain (instead of the Docker IP)
|
||||||
|
|
||||||
|
Assuming your custom domain is `laravel.dev` and your current `Docker-IP` is `xxx.xxx.xxx.xxx`.
|
||||||
|
|
||||||
|
1 - Open your `/etc/hosts` file and map your `Docker IP` to the `laravel.dev` domain, by adding the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
xxx.xxx.xxx.xxx laravel.dev
|
||||||
|
```
|
||||||
|
|
||||||
|
2 - Open your Laravel's `.env` file and replace the `127.0.0.1` default values with your `{Docker-IP}`.
|
||||||
|
<br>
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```env
|
||||||
|
DB_HOST=xxx.xxx.xxx.xxx
|
||||||
|
```
|
||||||
|
|
||||||
|
3 - Open your browser and visit `{http://laravel.dev}`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Optionally you can define the server name in the nginx config file, like this:
|
||||||
|
|
||||||
|
```conf
|
||||||
|
server_name laravel.dev;
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
> **boot2docker** users: run `boot2docker ip` *(when boot2docker is up)*.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,14 +11,16 @@ ENV LC_CTYPE=UTF-8
|
|||||||
ENV LANG=en_US.UTF-8
|
ENV LANG=en_US.UTF-8
|
||||||
ENV TERM xterm
|
ENV TERM xterm
|
||||||
|
|
||||||
# Install "software-properties-common" (for add-apt-repository) and add the "PHP 7" ppa
|
# Install "software-properties-common" (for the "add-apt-repository")
|
||||||
RUN apt-get update \
|
RUN apt-get update && apt-get install -y \
|
||||||
&& apt-get install -y software-properties-common \
|
software-properties-common
|
||||||
&& add-apt-repository -y ppa:ondrej/php
|
|
||||||
|
|
||||||
# Install PHP-CLI 7 and some useful Tools
|
# Add the "PHP 7" ppa
|
||||||
RUN apt-get update \
|
RUN add-apt-repository -y \
|
||||||
&& apt-get install -y \
|
ppa:ondrej/php
|
||||||
|
|
||||||
|
# Install PHP-CLI 7, some PHP extentions and some useful Tools with APT
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
php7.0-cli \
|
php7.0-cli \
|
||||||
php7.0-common \
|
php7.0-common \
|
||||||
php7.0-curl \
|
php7.0-curl \
|
||||||
@ -27,11 +29,32 @@ RUN apt-get update \
|
|||||||
php7.0-mbstring \
|
php7.0-mbstring \
|
||||||
php7.0-mcrypt \
|
php7.0-mcrypt \
|
||||||
php7.0-mysql \
|
php7.0-mysql \
|
||||||
|
php7.0-sqlite \
|
||||||
|
php7.0-sqlite3 \
|
||||||
php7.0-zip \
|
php7.0-zip \
|
||||||
|
sqlite3 \
|
||||||
|
libsqlite3-dev \
|
||||||
git \
|
git \
|
||||||
curl \
|
curl \
|
||||||
vim \
|
vim \
|
||||||
nano
|
nano \
|
||||||
|
nodejs \
|
||||||
|
nodejs-dev \
|
||||||
|
npm
|
||||||
|
|
||||||
|
# Clean up, to free some space
|
||||||
|
RUN apt-get clean
|
||||||
|
|
||||||
|
# Install gulp and bower with NPM
|
||||||
|
RUN npm install -g \
|
||||||
|
gulp \
|
||||||
|
bower
|
||||||
|
|
||||||
|
# Add a symbolic link for Node
|
||||||
|
RUN ln -s /usr/bin/nodejs /usr/bin/node
|
||||||
|
|
||||||
|
# Add an alias for PHPUnit
|
||||||
|
RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc
|
||||||
|
|
||||||
# Install Composer
|
# Install Composer
|
||||||
RUN curl -s http://getcomposer.org/installer | php \
|
RUN curl -s http://getcomposer.org/installer | php \
|
||||||
@ -42,14 +65,10 @@ RUN curl -s http://getcomposer.org/installer | php \
|
|||||||
RUN composer.phar global require "laravel/installer" \
|
RUN composer.phar global require "laravel/installer" \
|
||||||
&& echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc
|
&& echo "export PATH='~/.composer/vendor/bin:$PATH'" >> ~/.bashrc
|
||||||
|
|
||||||
# Add an alias for PHPUnit
|
|
||||||
RUN echo "alias phpunit='./vendor/bin/phpunit'" >> ~/.bashrc
|
|
||||||
|
|
||||||
# Source the bash
|
# Source the bash
|
||||||
RUN . ~/.bashrc
|
RUN . ~/.bashrc
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
RUN apt-get autoclean && apt-get clean \
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
||||||
|
|
||||||
WORKDIR /var/www/laravel
|
WORKDIR /var/www/laravel
|
||||||
|
Reference in New Issue
Block a user