Integration with Travis CI requires minimal changes and adding less than two seconds to your build time.
# Use container-based infrastructure for quicker build start-up
sudo: false
# Use generic image to cut start-up time
language: generic
env:
# Path to 'hadolint' binary
HADOLINT: "${HOME}/hadolint"
install:
# Download hadolint binary and set it as executable
- curl -sL -o ${HADOLINT} "https://github.com/hadolint/hadolint/releases/download/v1.9.0/hadolint-$(uname -s)-$(uname -m)"
&& chmod 700 ${HADOLINT}
script:
# List files which name starts with 'Dockerfile'
# eg. Dockerfile, Dockerfile.build, etc.
- git ls-files --exclude='Dockerfile*' --ignored | xargs --max-lines=1 ${HADOLINT}
For GitLab CI you need a basic shell in your docker image so you have to use the debian based images of hadolint.
Add the following job to your projects .gitlab-ci.yml
:
lint_dockerfile:
stage: lint
image: hadolint/hadolint:latest-debian
script:
- hadolint Dockerfile
Using hadolint in your terminal is not always the most convinient way, but it can be integrated into your editor to give you a feedback as you write your Dockerfile.
Atom is a text editor that's modern, approachable, yet hackable to the core—a tool you can customize to do anything but also use productively without ever touching a config file.
Thanks to lucasdf, there is an integration linter-hadolint with Atom.
A sophisticated text editor for code, markup and prose.
Thanks to niksite, there is an integration SublimeLinter-contrib-hadolint with Sublime Text.
Hadolint is used in two plugins:
-
Syntastic - syntax checking plugin for Vim created by Martin Grenfell.
-
ALE (Asynchronous Lint Engine) - plugin for providing linting in NeoVim and Vim 8 while you edit your text files.
Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, macOS and Linux.
There is an integration vscode-hadolint with VS Code, built by ExiaSR.