Run composer install in dev container #738
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today, starting a dev container using
curl -s "https://laravel.build/example-app?with=mysql,redis&devcontainer" | bash
(or any version with a dev container I assume), it works great. However, if I push that repo to GitHub and clone it back down, the dev container will not start.That happens because the docker-compose.yml refers to ./vendor, which of course doesn't exist (yet).
I have done some testing on my end, and running this command before creating the dev container ensures that
./vendor/laravel/sail/runtimes/8.3(/Dockerfile)
exists before trying to create the container.The command is from https://laravel.com/docs/11.x/sail#installing-composer-dependencies-for-existing-projects
For this to work, you would need to add the following to the .env file:
This PR, or something like it, aims to make it easier for new developers to get started with the Laravel dev container.
Note: I am completely new to Laravel and somewhat new to Docker. If this is not the fix here, please let me know.