DEV Community

loading...

Discussion on: docker-compose up your entire Laravel + Apache + MySQL development environment.

veevidify profile image
V Author • Edited

If you refer back to docker-compose.yml, this part:

...
      args:
        uid: ${UID}

docker-compose requires UID environment variable to be set. Check your .env file, make sure

UID=1000 # or whatever your host's user id is

If you're unsure about host user id, type id in your terminal to double check.

Thread Thread
tenerecodes profile image
tenerecodes

That worked fine thank you. but i have another question, if you permit, regarding your Dockerfile. how to copy npm from nodejs docker image like you did with composer.

the reason i ask this is because when i run "php artisan ui vue --auth" i get this message:

Vue scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.
Authentication scaffolding generated successfully.

Thread Thread
veevidify profile image
V Author • Edited

There is a neat little trick to run a docker container as if it's a binary in your host. This is very useful for things like composer or npm which only modifies files statically. Example:

$ cd /your/project/folder
$ docker run -it -u 1000:1000 -v "$PWD":/usr/src/app -w /usr/src/app --rm node:10 npm install

Make sure all the parameters are what you need, e.g. uid, node version, etc.

Even though I copy composer binary into the my own app image for "encapsulation", if we intend to only ever use such binary for static files modification on the host, that wouldn't be necessary. Instead this trick makes it more clean once you start having 5 6 container runtime for these sorts of purposes.

I conveniently "missed out" this part due to how varied people's use cases with node are.