Skip to content
Snippets Groups Projects
Commit e2c119b8 authored by nimrod's avatar nimrod
Browse files

First working version.

parent 601bcb9d
No related branches found
No related tags found
No related merge requests found
*
!docker-compose-config
~*
*~
*.sw[op]
*.py[cod]
.DS_Store
__pycache__/
.vagrant/
vendor/
Thumbs.db
*.retry
.svn/
.sass-cache/
*.log
*.out
*.so
node_modules/
.npm/
nbproject/
*.ipynb
.idea/
*.egg-info/
*.[ao]
.classpath
.cache/
bower_components/
*.class
*.[ewj]ar
secring.*
.*.kate-swp
.swp.*
.directory
.Trash-*
build/
_build/
dist/
.tox/
*.pdf
*.exe
*.dll
*.gz
*.tgz
*.tar
*.rar
*.zip
*.pid
*.lock
*.env
.bundle/
!Pipfile.lock
# vim:ff=unix ts=2 sw=2 ai expandtab
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: check-added-large-files
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: detect-private-key
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint
rev: v1.16.0
hooks:
- id: yamllint
- repo: https://github.com/amperser/proselint
rev: 0.10.2
hooks:
- id: proselint
types: [plain-text]
exclude: LICENSE
- repo: https://www.shore.co.il/git/shell-pre-commit/
rev: v0.6.0
hooks:
- id: shell-lint
- id: shellcheck
- repo: local
hooks:
- id: hadolint
name: Hadolint Dockerfile linter
description: Dockerfile linter, validate inline bash, written in Haskell
minimum_pre_commit_version: '0.18.0'
language: docker
entry: hadolint
files: Dockerfile
- id: docker-compose
name: docker-compose config
description: Validate the Docker Compose file using docker-compose config
minimum_pre_commit_version: '0.18.0'
language: docker
entry: docker-compose-config
files: docker-compose
types: [ yaml ]
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
minimum_pre_commit_version: '0.18.0' minimum_pre_commit_version: '0.18.0'
language: docker_image language: docker_image
entry: adarnimrod/docker-pre-commit hadolint entry: adarnimrod/docker-pre-commit hadolint
files: Dockerfile type: [ dockerfile ]
- id: docker-compose - id: docker-compose
name: docker-compose config name: docker-compose config
description: Validate the docker-compose file description: Validate the Docker Compose file using docker-compose config
minimum_pre_commit_version: '0.18.0' minimum_pre_commit_version: '0.18.0'
language: docker_image language: docker_image
entry: adarnimrod/docker-pre-commit docker-compose-config entry: adarnimrod/docker-pre-commit docker-compose-config
......
...@@ -2,3 +2,4 @@ FROM alpine:3.10 ...@@ -2,3 +2,4 @@ FROM alpine:3.10
RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ docker-compose && \ RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ docker-compose && \
wget https://github.com/hadolint/hadolint/releases/download/v1.17.1/hadolint-Linux-x86_64 -O /usr/local/bin/hadolint && \ wget https://github.com/hadolint/hadolint/releases/download/v1.17.1/hadolint-Linux-x86_64 -O /usr/local/bin/hadolint && \
chmod +x /usr/local/bin/hadolint chmod +x /usr/local/bin/hadolint
COPY docker-compose-config /usr/local/bin/
MIT License
Copyright (c) 2019 Adar Nimrod
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.
# Docker pre-commmit
> Pre-commit hooks for Docker and docker-compose.
## Requirements
- [Docker](https://www.docker.com/).
- [pre-commit](https://pre-commit.com/) 0.18.0 or later.
## Hooks
- `hadolint` - The [hadolint](https://github.com/hadolint/hadolint) Dockerfile
linter.
- `docker-compose` - Validate the Docker Compose file using `docker-compose
config`.
## Usage example
```yaml
- repo: https://www.shore.co.il/git/docker-pre-commit
rev: v0.1.0
hooks:
- id: hadolint
- id: docker-compose
```
## License
This software is licensed under the MIT license (see `LICENSE.txt`).
## Author Information
Nimrod Adar, [contact me](mailto:nimrod@shore.co.il) or visit my [website](
https://www.shore.co.il/). Patches are welcome via [`git send-email`](
http://git-scm.com/book/en/v2/Git-Commands-Email). The repository is located
at: <https://www.shore.co.il/git/>.
0.0.1
#!/bin/sh
set -eu
for filename in "$@"
do
docker-compose --file "$filename" config || failed=1
done
[ "${failed:-0}" -eq '0' ]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment