By: Mark Dionnie Bulingit
Credits to ther Author, very comprehensive topic about dockerizing laravel.
https://medium.com/@chewysalmon/laravel-docker-development-setup-an-updated-guide-72842dfe8bdf
Laravel uses Composer to install dependencies, we use composer-image from dockerhub to install composer inside our project container and delete it after -pretty convenient.
docker run --rm -v ${pwd}:/app composer install
Now we have Composer but only inside the container, we will start ou laravel commands with e.g
docker-compose exec app php artisan key:generate
composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.0.30.
Go to package.json
"config": {
"platform-check": false
},
docker run --rm -v ${pwd}:/app composer dump-autoload
Note: Make sure you're using Powershell terminal and Docker Desktop is running.
docker-compose down ; docker run --rm -v ${pwd}:/app composer install ; docker run --rm -v ${pwd}:/app composer install ; docker-compose up
- Stops and Delete containers
- Install dependecies
- Start and run containers
- docker-compose.yaml
- web.dockerfile
- app.dockerfile
- vhost.conf