Skip to content

ci: add Dockerfile linting with Hadolint#429

Open
ivantodorovich wants to merge 1 commit intorelease-4.5.Xfrom
ci-hadolint-linting
Open

ci: add Dockerfile linting with Hadolint#429
ivantodorovich wants to merge 1 commit intorelease-4.5.Xfrom
ci-hadolint-linting

Conversation

@ivantodorovich
Copy link
Copy Markdown
Member

Add Hadolint to CI and pre-commit to catch Dockerfile issues automatically.

Fixes for existing Dockerfile issues found by Hadolint:

  • Replace deprecated MAINTAINER with LABEL maintainer= (DL4000)
  • Add trailing slash to multi-arg COPY destinations (DL3021)
  • Consolidate consecutive RUN instructions in example (DL3059)
  • Use WORKDIR instead of cd in example (DL3003)

Add Hadolint to CI and pre-commit to catch Dockerfile issues
automatically.

New files:
- .hadolint.yaml: project-specific rule configuration
- .pre-commit-config.yaml: hadolint-docker hook for local linting
- hadolint job in GitHub Actions workflow (runs in parallel with build)

Fixes for existing Dockerfile issues found by Hadolint:
- Replace deprecated MAINTAINER with LABEL maintainer= (DL4000)
- Add trailing slash to multi-arg COPY destinations (DL3021)
- Consolidate consecutive RUN instructions in example (DL3059)
- Use WORKDIR instead of cd in example (DL3003)
@ivantodorovich ivantodorovich marked this pull request as ready for review April 8, 2026 13:17
Copy link
Copy Markdown
Contributor

@florentx florentx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

steps:
- uses: actions/checkout@v6
- name: Lint Dockerfiles
uses: hadolint/hadolint-action@v3.3.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1st question

Should we start pinning actions to commit SHA instead of tag, as recommended?

https://docs.github.com/en/actions/reference/security/secure-use#using-third-party-actions

2nd question

What is benefit of having it in a separate job, if it is already part of pre-commit hooks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants