We are using docker containers for local development and we are having the trouble of indexing the vendor folder for autocomplete when setting up the container. We use the following tools:
- Pack CLI (https://buildpacks.io/) for orchestrating the build process for the docker image.
- Heroku PHP buildpack (https://github.com/heroku/heroku-buildpack-php) for building the docker image.
- Docker Compose for starting all the services we need, including the web process where PHP and Nginx runs.
Main Issue: Autocomplete doesn't work when launching a docker remote interpreter as run configuration.
Ideally the vendor folder (inside the docker container) should be indexed by the IDE to allow autocomplete to function as expected.
The workaround right now is to either:
1. Copy the vendor folder to the host (not ideal as we need to manually keep in sync when installing new dependencies),
2. Install all dependencies on the host system before building the container (skips composer installing dependencies when running the heroku php buildpack as the vendor folder already exists) or
3. Setup a docker volume and sync the vendor folder between container and host.
However the latter doesn't work if the host vendor folder is empty or does not exist. It simply overwrites the folder in the container and prevents the server from starting.
Is there a way to index the folder in the docker container (docker-compose.yml remote interpreter/run configuration)?
This would really be the missing piece of our setup, as this would mean we won't have to:
1. Manually keep the vendor folder in sync
2. Run `composer install --ignore-platform-reqs` on the host machine that may not have composer.
3. Setup a potentially slow docker volume to sync changes to the vendor folder between the host and container.
I really can't seem to find much on the web about this topic which I was surprised about. Seems like an obvious one to me, but maybe I'm just oblivious and fundamentally missing something important?
Copying files to the host or syncing them with the host is really not want we want to be doing these days and defeats the point of an isolated development environment. VS Code has an awesome solution to this using the Remote development Extension Pack where the entire project runs in a container and is indexed by the IDE as one would expect. Is there a PHPStorm equivalent?
It would be REALLY awesome to solve this and look forward to your suggestions and solutions.