chore: add dockerfile (#183)

This commit is contained in:
Manuel Vogel 2021-03-12 15:35:21 +01:00 committed by GitHub
commit 36a269f109
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 0 deletions

View file

@ -13,6 +13,8 @@
* [`coreutils`](https://formulae.brew.sh/formula/coreutils) required for `terraform_validate` hook on macOS (due to use of `realpath`).
* [`checkov`](https://github.com/bridgecrewio/checkov) required for `checkov` hook.
or build and use the Docker image locally as mentioned below in the `Run` section.
##### MacOS
```bash
@ -34,6 +36,7 @@ python3.7 -m pip install -U checkovpython3.7 -m pip install -U checkov
```
### 2. Install the pre-commit hook globally
Note: not needed if you use the Docker image
```bash
DIR=~/.git-template
@ -65,6 +68,15 @@ After pre-commit hook has been installed you can run it manually on all files in
pre-commit run -a
```
or you can also build and use the provided Docker container, which wraps all dependencies by
```bash
# first building it
docker build -t pre-commit .
# and then running it in the folder
# with the terraform code you want to check by executing
docker run -v $(pwd):/lint -w /lint pre-commit run -a
```
## Available Hooks
There are several [pre-commit](https://pre-commit.com/) hooks to keep Terraform configurations (both `*.tf` and `*.tfvars`) and Terragrunt configurations (`*.hcl`) in a good shape: