Skip to content

Commit 5aa01b1

Browse files
committed
add the new way of using LaraDock in the readme
1 parent 3b2831b commit 5aa01b1

1 file changed

Lines changed: 57 additions & 15 deletions

File tree

README.md

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ docker-compose up nginx mysql
8787
- Memcached
8888
- Beanstalkd
8989
- Beanstalkd Console
90+
- Workspace (includes: Composer, PHP7-CLI , Laravel Installer, Git, Vim, Nano, cURL)
9091
- Data Volume *(Databases Data Container)*
9192
- Application *(Application Code Container)*
92-
- Workspace (includes: `Git`, `Vim`, `nano`, `PHP-CLI 7.0`, `cURL`)
93+
9394

9495
>If you can't find your container, build it yourself and add it to this list. Contributions are welcomed :)
9596
@@ -148,57 +149,98 @@ Running a virtual Container is much faster than running a full virtual Machine.
148149
<a name="Installation"></a>
149150
## Installation
150151

151-
1 - Clone the `LaraDock` repository, in any of your `Laravel` projects:
152+
#### A] In existing Laravel Projects:
153+
154+
1 - Clone the `LaraDock` repository, inside your `Laravel` project root direcotry:
152155

153156
```bash
154-
git clone https://github.com/LaraDock/laradock.git docker
157+
git submodule add https://github.com/LaraDock/laradock.git
155158
```
156159

157-
You can use `git submodule add` instead of `git clone` if you are already using Git for your Laravel project *(Recommended)*:
160+
2 - That's it, jump to the Usage section now.
161+
162+
*If you are not already using Git for your Laravel project, you can use `git clone` instead of `git submodule`.*
163+
164+
165+
#### B] Starting from scratch (we will install Laravel):
166+
167+
*If you don't have any Laravel project yet, and you want to start your Laravel project with Docker.*
168+
169+
1 - Clone the `LaraDock` repository anywhere on your machine:
158170

159171
```bash
160-
git submodule add https://github.com/LaraDock/laradock.git docker
172+
git clone https://github.com/LaraDock/laradock.git
161173
```
162174

163-
>These commands should create a `docker` folder, on the root directory of your Laravel project.
175+
2 - Go to the Uage section below and do the steps 1 and 3 then come back here.
176+
177+
3 - Enter the Workspace container. (assuming you have the Workspace container running):
178+
179+
```bash
180+
docker exec -it {Workspace-Container-Name} bash
181+
```
182+
Replace `{Workspace-Container-Name}` with your Workspace container name. To get the name type `docker-compose ps` and copy it.
183+
184+
4 - Install Laravel anyway you like.
185+
186+
Example using the Laravel Installer:
187+
188+
```bash
189+
laravel new my-cool-app
190+
```
191+
For more about this check out this [link](https://laravel.com/docs/master#installing-laravel).
192+
193+
5 - Edit `docker-compose.yml` to Map the new application path:
194+
195+
By default LaraDock assumes the Laravel application is living in the parent directory of the laradock folder.
196+
197+
Since the new Laravel application is in the `my-cool-app` folder, we should replace `../:/var/www/laravel` with `../my-cool-app/:/var/www/laravel`, as follow:
198+
199+
```yaml
200+
application:
201+
build: ./application
202+
volumes:
203+
- ../my-cool-app/:/var/www/laravel
204+
```
205+
6 - Finallt go to the Usage section below again and do steps 2 and 4.
164206
165207
166208
167209
168210
<a name="Usage"></a>
169211
## Usage
170212
171-
0 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine.
213+
1 - For **Windows & MAC** users only: make sure you have a running Docker Virtual Host on your machine.
172214
(**Linux** users don't need a Virtual Host, so skip this step).
173215
<br>
174216
[How to run a Docker Virtual Host?](#Run-Docker-Virtual-Host)
175217
176218
177219
<br>
178-
1 - Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`:
220+
2 - Open your Laravel's `.env` file and set the `DB_HOST` to your `{Docker-IP}`:
179221

180222
```env
181223
DB_HOST=xxx.xxx.xxx.xxx
182224
```
183225
[How to find my Docker IP Address?](#Find-Docker-IP-Address)
184226

185227
<br>
186-
2 - Run the Containers, (you can select the software's (containers) that you wish to run)
228+
3 - Run the Containers, (you can select the software's (containers) that you wish to run)
187229
<br>
188-
*Make sure you are in the `docker` folder before running the `docker-compose` command.*
230+
*Make sure you are in the `laradock` folder before running the `docker-compose` command.*
189231

190-
**Example:** Running NGINX, MySQL, Redis and the workspace:
232+
**Example:** Running NGINX, MySQL, Redis and the Workspace:
191233

192234
```bash
193-
docker-compose up -d nginx mysql redis Workspace
235+
docker-compose up -d nginx mysql redis workspace
194236
```
195237
*Note: the PHP-FPM, Application and Data Containers will automatically run.*
196238

197239

198-
Supported Containers: `nginx`, `workspace`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `application`.
240+
Supported Containers: `workspace`, `nginx`, `mysql`, `redis`, `postgres`, `mariadb`, `memcached`, `beanstalkd`, `beanstalkd-console`, `data`, `php-fpm`, `application`.
199241

200242
<br>
201-
3 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
243+
4 - Open your browser and visit your `{Docker-IP}` address (`http://xxx.xxx.xxx.xxx`).
202244

203245

204246
<br>
@@ -314,7 +356,7 @@ Supported Versions:
314356
docker-compose build php
315357
```
316358

317-
For more details visit the [official PHP docker images](https://hub.docker.com/_/php/).
359+
For more details about the PHP base image, visit the [official PHP docker images](https://hub.docker.com/_/php/).
318360

319361

320362
<br>

0 commit comments

Comments
 (0)