DEV Community

Cover image for Crafting a better local Laravel dev environment with Docker

Crafting a better local Laravel dev environment with Docker

Andrew Schmelyun on February 19, 2020

tl;dr If you'd like a more visual aide, I've published a video which follows along with this tutorial in depth. It shows you all of the ...
Collapse
 
shabrany profile image
Jorge fernandez • Edited

Thank you for this amazing tutorial!

By the way, I came across this bug when trying to build the assets:

sh: 1: cross-env: not found

By removing the flag --no-bin-links was possible to build the assets again using docker-compose run --rm npm run dev

Collapse
 
castraea profile image
cAstraea

Hello, can anyone help please with this. Having an issue running npm install using this setup. It seems it doesn't like the node-sass dependency and starts spamming something about gyp and compiling stuff. Also the composer container complained about some missing php extensions like gd and gmp so I had to run it directly from the php container instead.

Collapse
 
deancollins84 profile image
Dean Collins

Thanks for this. Awesome!

However when I run composer install, it fails when trying to run artisan command

"post-autoload-dump": [
"Illuminate\Foundation\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],

You have any ideas on how I get the composer container to talk to the php/app container?

Collapse
 
naneri profile image
naneri

What does --rm option do?

Collapse
 
aschmelyun profile image
Andrew Schmelyun

It destroys the Docker container once it's use has finished up. Otherwise, it will remain active on the system until you bring it down.

Collapse
 
naneri profile image
naneri

Can the network part be removed in compose file for npm and composer? If those are destroyed anyways?

Collapse
 
yogeshgalav7 profile image
Yogesh Galav

When running docker-compose run --rm composer install it shows php version 8 is not compatible while we used version-7.2 in php container.
Also can we access terminal to run all php, artisan and node commands like we run in "laradock workspace".

Collapse
 
tylerlwsmith profile image
Tyler Smith

There are some really interesting ideas in here. Thanks for sharing this!

Collapse
 
fuhrmann profile image
Ricardo Fuhrmann • Edited

I'm going to experiment this setup. Pretty good, just what I was looking for. Thanks!