by default, vendor is not in version control (i.e. it's in gitignore)
so when you pull this project to another computer that has no PHP or Composer installed, you cant run 'sail' command because there is no vendor folder.
bash: vendor/bin/sail: No such file or directory
I thought the whole point of Docker and Sail was so we can use containers on environments with no local setup required.
Anybody got an idea how to run the sail project like this?
@kokoshneta Well, that’s the point of a containerised environment, innit?
@sinnbeck You can install the Composer dependencies using an on-demand Docker container like in the accepted answer. I actually do this myself by creating a simple shell script with that command and then a Makefile that runs it. It means someone can clone my repo and just run make install to get set up without needing Composer or PHP on their machine.
My point was that I assumed the sail:install command would create the sail executable. So here you well need to use a second docker command to run artisan and install it. Using the sail tools wouldn't be possible to use directly
@martinbean I’ve never really used containerised environments, but my understanding is that even in those, PHP must still be installed in the image. How would anything be parsed in Laravel if there’s no PHP installation anywhere to parse it?
Edit: I assumed that, since running php artisan … commands would be entirely parallel to running the composer command in the accepted self-answer, the follow-up question must be about cases where there’s no PHP in the container. Rereading, perhaps it’s not as obvious as I’d read it, so I may have misinterpreted the follow-up.
@kokoshneta Yes, but the PHP installation lives in an image and not on your machine. So you pipe your PHP commands to the image that contains PHP to be executed, rather than running them directly on your computer.
@chibs this doesn't work if you've got e.g. platform requirements, such as PHP extensions, that are not included in the laravelsail/php80-composer image. Which is most of your specific platform requirements.