-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
166 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
reviewers: | ||
- pehbehbeh | ||
assignees: | ||
- pehbehbeh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build and push edge image | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: | | ||
sourceboat/docker-compose-githooks:edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Build and push stable image | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Docker meta builder | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: | | ||
sourceboat/docker-compose-githooks | ||
flavour: | | ||
latest=true | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
FROM busybox:latest | ||
FROM busybox:1.34.1 | ||
|
||
ENTRYPOINT sh -c "cd /tmp/.githooks && ls | xargs chmod +x && cd /tmp/.git/hooks && find ../../.githooks -type f -exec ln -sf {} /tmp/.git/hooks/ \; && echo 'githooks installed'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) Sourceboat GmbH & Co. KG <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# docker-compose-githooks | ||
|
||
[![Docker Build Status](https://img.shields.io/docker/cloud/build/sourceboat/docker-compose-githooks.svg?style=flat-square)](https://hub.docker.com/r/sourceboat/docker-compose-githooks/builds/) | ||
[![Release](https://img.shields.io/github/release/sourceboat/docker-compose-githooks.svg?style=flat-square)](https://github.com/sourceboat/docker-compose-githooks/releases) | ||
[![Docker Pulls](https://img.shields.io/docker/pulls/sourceboat/docker-compose-githooks.svg?style=flat-square)](https://hub.docker.com/r/sourceboat/docker-compose-githooks/) | ||
[![Image Size](https://img.shields.io/docker/image-size/sourceboat/docker-compose-githooks?style=flat-square)](https://microbadger.com/images/sourceboat/docker-compose-githooks) | ||
[![MicroBadger Layers](https://img.shields.io/microbadger/layers/sourceboat/docker-compose-githooks.svg?style=flat-square)](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. |