How to pre-commit in Docker Development

It is clear that pre-commit cannot work inside Docker containers and it can only work with git stored on the local machine since its not in a shared volume with the containers. Therefore, it should be noted that anyone who uses this cookicutter with pre-commit already generated by default in every project, should start using pre-commit into their general workflow.
This commit is contained in:
Abdul Qoyyuum 2021-08-06 15:55:40 +01:00 committed by GitHub
parent 103cc9f2ff
commit 370cefdf24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,6 +32,17 @@ This can take a while, especially the first time you run this particular command
Generally, if you want to emulate production environment use ``production.yml`` instead. And this is true for any other actions you might need to perform: whenever a switch is required, just do it!
Before doing any commit, pre-commit hooks are required on your local machine, outside of docker::
$ pip install -r requirements/local.txt # Advisable within a virtualenv if possible
$ git init # A git repo is required for pre-commit to install
$ pre-commit install
.. note::
the `pre-commit` hook exists in the generated project as default.
For the details of `pre-commit`, follow the `pre-commit`_ site.
Run the Stack
-------------