Skip to content

Commit

Permalink
Merge branch 'release/1.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pehbehbeh committed Nov 2, 2021
2 parents 112af4c + 7d17664 commit 00cf171
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 11 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
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
35 changes: 35 additions & 0 deletions .github/workflows/Edge.yml
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
47 changes: 47 additions & 0 deletions .github/workflows/Stable.yml
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 }}
2 changes: 1 addition & 1 deletion Dockerfile
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'"
21 changes: 21 additions & 0 deletions LICENSE.md
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.
52 changes: 52 additions & 0 deletions README.md
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.
10 changes: 0 additions & 10 deletions readme.md

This file was deleted.

0 comments on commit 00cf171

Please sign in to comment.