ansys/actions

Add Dockerfile linting

Closed this issue ยท 2 comments

๐Ÿ“ Description of the feature

After using hadolint on a project, I was reminded of some good practices when writing a Dockerfile.
Adding this lint to ansys repos should be of great help to increase the quality of our products.

After some discussion with @RobPasMue the idea would be to:

  • add a step to the code-style action with some checking on the directory to check
  • create an independent public action as code-style action gets removed in favor of using pre-commit.ci.

Note: the action can either leverage hadolint-action or hadolint-gh-action.

๐Ÿ’ก Steps for implementing the feature

We have to be carefull of the way we want to discover and check multiple dockerfiles as hadolint-action and hadolint-gh-action do not work in the same way when trying to deal with multiple dockerfiles.

๐Ÿ”— Useful links and references

No response

My suggestion would be to:

  • Create a wrapped hadolint-action/hadolint-gh-action (e.g. docker-style?).
  • From the code-syle action, simply call the docker-style action. You could even surface this step as "optional" through a boolean to the code-style action
  • The docker-style action should verify that a user has (at least) a "docker" folder that contains the repository's Dockerfiles. Dockerfiles shouldn't be placed anywhere else. Then, you simply run the hadolint-* action with some predefined inputs to ensure consistency across our repos.

Closed by #382