This docker script is optimized for a development environment and implements the following technologies for a Laravel app:
- Php 7.4
- Nginx
- MySql
- PhpMyadmin
- Mailhog
-
Set the .env variables
#!/bin/bash cp .env.example
-
Build the images
#!/bin/bash docker-compose build
-
Start containers
#!/bin/bash docker-compose up -d
-
Install dependencies inside containser
#!/bin/bash docker-compose exec app composer install
-
Set app key
#!/bin/bash docker-compose exec app php artisan key:generate
-
Run migrations
#!/bin/bash docker-compose exec app php artisan migrate
-
Browse at
NOTES:
- Enter the main container
#!/bin/bash
docker-compose exec app bash
Roberth Rodriguez, Laravel the web artisan