I am working on a Laravel app that uses Laravel Sail within DevContainers for a Docker-based development environment. Everything was working fine locally until I uploaded the project code to GitHub without the vendor folder (as it’s typically excluded), and then I erased my local environment and cloned the repo.
After cloning and trying to run the devcontainer, I encountered the following error:
Error: ENOENT: no such file or directory, open '/home/neo/code/projects/project/vendor/laravel/sail/runtimes/8.3/Dockerfile'
It seems like the devcontainer can’t find the Dockerfile because it’s located inside the vendor/laravel/sail folder, which isn’t uploaded to GitHub.
My Understanding is since the vendor folder is excluded from version control, it’s not available when cloning the repo. Normally, I would run composer install to bring in those dependencies. However, my understanding of DevContainers was that it would provide a fully isolated environment with everything pre-installed, so I wouldn’t need to install anything locally.
My Question is there a way to configure the DevContainer setup so that it can work without needing the vendor folder locally? Specifically, how can I get the devcontainer to work without having to run composer install every time or include the vendor folder in version control?
Or am I misunderstanding the promise of DevContainers in this case?
Additional Info:
I’m using Laravel Sail for Docker integration.
The Dockerfile is inside the vendor/laravel/sail/runtimes/8.3/Dockerfile.
I do not want to include the vendor folder in version control.
My goal is to keep the process as streamlined as possible when switching machines or setting up a fresh environment.
1