Skip to content

Latest commit

 

History

History
117 lines (85 loc) · 3.42 KB

INTEGRATION.md

File metadata and controls

117 lines (85 loc) · 3.42 KB

Hadolint Integrations

Automated Code Review

Codacy

Codacy automates hadolint code reviews on every commit and pull request, reporting code style and error prone issues.

Travis CI

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}

Gitlab CI

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 project's .gitlab-ci.yml:

lint_dockerfile:
  stage: lint
  image: hadolint/hadolint:latest-debian
  script:
    - hadolint Dockerfile

Drone CI

For Drone CI, a basic shell is similiarly required.

Add the following job to your project's .drone.yml pipeline:

  hadolint:
    group: validate
    image: hadolint/hadolint:latest-debian
    commands:
      - hadolint --version
      - hadolint Dockerfile

Editors

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

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.

linter-hadolint-img

Sublime Text 3

A sophisticated text editor for code, markup and prose.

Thanks to niksite, there is an integration SublimeLinter-contrib-hadolint with Sublime Text.

Vim and NeoVim

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.

VS Code

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.

vscode-hadolint-gif