Docker linter for CI #14
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dockerfile Lint | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| hadolint: | |
| name: Lint Dockerfiles | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install hadolint | |
| run: sudo wget -O /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64 && sudo chmod +x /usr/local/bin/hadolint | |
| - name: Find and lint all Dockerfiles | |
| run: | | |
| echo "Searching for Dockerfiles..." | |
| files=$(find . -type f -name "Dockerfile") | |
| for file in $files; do | |
| echo "Linting $file" | |
| hadolint --failure-threshold error "$file" || { | |
| echo "Lint failed for $file" | |
| exit 1 | |
| } | |
| done | |
| - name: Summary | |
| if: success() | |
| run: echo "All Dockerfiles passed linting checks" |