We forked the stack from git repository at here: Murilolivorato Laravel Docker Environment
Laravel, the PHP web application framework, and Docker, the containerization platform, are a match made in heaven for developers seeking scalability, efficiency, and ease of deployment. In this extensive guide, we’ll delve deep into the integration of Laravel with Docker, exploring the intricacies of setting up a robust environment and establishing seamless communication between two Laravel projects.
Here’s a list of the services we’ll be creating in our Docker environment —
PHP — 8.2-fpm-alpine
Nginx — nginx:stable-alpine
MySQL — mysql:8.0.1
Mailhog
PhpMyAdmin
Redis
Run Treafik proxy before:
- cd to treafik sub-folder.
- then run command:
docker-compose up -d
- Docker Build Image:
docker-compose build
- Run Docker Containers:
docker-compose up -d
- Composer Install:
docker-compose run --rm composer install
Or We alsow can create Laravel Project and Set Database with command bellow:
docker-compose run --rm composer create-project laravel/laravel
- Generate Key:
docker-compose run --rm artisan key:generate
- Clear Config Cache:
docker-compose run --rm artisan config:cache
- Migrate Database:
docker-compose run --rm artisan migrate