https://github.com/sourceboat/docker-compose-githooks
Easily manage and version control Git Hooks in a Docker Compose setup.
https://github.com/sourceboat/docker-compose-githooks
docker docker-compose git git-hooks hacktoberfest
Last synced: 7 months ago
JSON representation
Easily manage and version control Git Hooks in a Docker Compose setup.
- Host: GitHub
- URL: https://github.com/sourceboat/docker-compose-githooks
- Owner: sourceboat
- License: mit
- Created: 2019-07-22T13:32:05.000Z (over 6 years ago)
- Default Branch: develop
- Last Pushed: 2024-10-02T03:08:36.000Z (over 1 year ago)
- Last Synced: 2025-04-28T16:49:34.753Z (10 months ago)
- Topics: docker, docker-compose, git, git-hooks, hacktoberfest
- Language: Dockerfile
- Homepage:
- Size: 29.3 KB
- Stars: 12
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# docker-compose-githooks
[](https://hub.docker.com/r/sourceboat/docker-compose-githooks/builds/)
[](https://github.com/sourceboat/docker-compose-githooks/releases)
[](https://hub.docker.com/r/sourceboat/docker-compose-githooks/)
[](https://microbadger.com/images/sourceboat/docker-compose-githooks)
[](https://microbadger.com/images/sourceboat/docker-compose-githooks)
Easily manage and version control [Git Hooks](https://git-scm.com/book/de/v1/Git-individuell-einrichten-Git-Hooks)
in a [Docker Compose](https://docs.docker.com/compose/) setup.
## Usage
Add a new service to your `.docker-compose.yml` file:
```yml
version: '3.7'
services:
// ...
githooks:
image: sourceboat/docker-compose-githooks:latest
volumes:
- ./.git:/tmp/.git
- ./.githooks:/tmp/.githooks
```
Now you can manage and version control your Git Hooks in the `.githooks` directory of your repository.
Everytime you run `docker-compose up` the `githooks` service will create symlinks in `.git/hooks` to all files found in the `.githooks` directory.
For example you can create a `.githooks/pre-commit` file to run your linters inside your running containers:
```sh
#!/bin/sh
echo 'running pre-commit hook...'
docker-compose exec -T app yarn lint
```
## Changelog
Check [releases](https://github.com/sourceboat/docker-compose-githooks/releases) for all notable changes.
## Credits
- This project is based on [an article by Aurélien Hervé](https://hackernoon.com/using-git-hooks-in-a-dockerized-environment-55372c40815f).
- [Phil-Bastian Berndt](https://github.com/pehbehbeh)
- [All Contributors](https://github.com/sourceboat/docker-compose-githooks/graphs/contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.