phpro / grumphp

A PHP code-quality tool
MIT License
4.15k stars 434 forks source link

What is the recommended way to use this tool when using docker? #1007

Closed guvra closed 2 years ago

guvra commented 2 years ago

Hi,

I'm using docker to manage my project, which has the following main structure:

.git/
app/  <-- mounted to the php container with a volume
docker-compose.yml
Makefile

Git (as well as the .git repository) is only available on the host, and php only available on the container. So it's not possible to run grumphp commands (run, git:pre-commit, git:init).

I'm wondering how to:

Is there a recommended way to work around these issues?

So far the only solution I've come up to is to manually create the pre-commit file, and manually pass $FILES from the host to the container before running grumphp (which might trigger an "argument list too long" error)

Thanks.

veewee commented 2 years ago

Hello,

We just include git and the .git folder in our development's PHP docker container. Works like a charm.

guvra commented 2 years ago

Thanks for the reply.

We solved the issue by using a separate repository for the files that reside in the app directory, and we added git to the container image.