Skip to content

Latest commit

 

History

History
95 lines (70 loc) · 2.96 KB

INTEGRATION.md

File metadata and controls

95 lines (70 loc) · 2.96 KB

Hadolint Integrations

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 projects .gitlab-ci.yml:

lint_dockerfile:
  stage: lint
  image: hadolint/hadolint:latest-debian
  script:
    - 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