Hello, I have recently been playing with pre-commit and have it set up for a project that doesn’t use docker containers. I am now looking at adding it to a project that does use docker containers with docker-compose and I am curious what the best practice is.
Currently, I develop this project on Windows using WSL2 and VS Code. I have a docker-compose file that I use for development which will allow me to run the runserver
command and access it with a Windows browser. I use git in WSL2, not inside the container. I also use poetry inside the container to manage dependencies.
Now I want to add pre-commit. I can think of a few ways this could be done.
- Install poetry in WSL2, install pre-commit in the WSL2 poetry environment, run git commands in WSL2. This would duplicate the environment in both WSL2 and in the container.
- Install pre-commit inside the container using poetry, run git commands inside the container
- Install pre-commit in WSL2, run the pre-commit commands inside the container using the docker or docker_image hooks
Thanks in advance.