Hello everyone. This is tyamahori. Are you developing with Docker for Mac? Isn't it slow and cluttered? .. ??
Good news for you. In January 2021, tyamahori faced a slow problem with Docker for Mac. Please see the sample project of Laravel on GitHub.
After composer install, you will have a vendor directory. You need to devise a way to mount this on the container.
For local development, you'll probably use docker-compose. In that case, use volumes to avoid putting files locally on your Mac.
However, if there is no vendor directory locally, PhpStorm etc. will not work. .. No matter how fast it gets, it doesn't make sense if you don't hear the complement. .. .. ??
Bring the vendor directory locally on your Mac after doing a composer installation inside the container. I have a command for docker cp
, so I use it to copy the directory locally on my Mac because there is no container!
Then, when do you do docker cp
? What to do if you add something with a new composer install. .. And so on. In such a case, make a script and do various trial and error. The script is placed in the sample project, so please refer to it.
If you bring the vendor directory locally to your Mac with docker cp
, PhpStorm will read the vendor directory. At that time, Mac fans will buzz around, so you have to put up with that. ..
I'd like you to try it first to see if it really gets faster. Clone the sample project and use Docker for Mac to launch it! We look forward to hearing from you!
https://github.com/tyamahori/laravel8-sample
Recommended Posts