Skip to content

Commit 9774ae7

Browse files
committed
CI: lint dockerfiles
1 parent 30c3aff commit 9774ae7

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,19 @@ jobs:
4747
components: clippy, rustfmt
4848
- name: Run transaction Fuzzing check
4949
run: make check-tx-fuzzing
50+
51+
hadolint:
52+
name: Hadolint - ${{ matrix.os }}
53+
runs-on: ${{ matrix.os }}
54+
strategy:
55+
matrix:
56+
os: [ubuntu-latest]
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Install hadolint
60+
run: |
61+
wget -O /tmp/hadolint https://github.com/hadolint/hadolint/releases/latest/download/hadolint-Linux-x86_64
62+
chmod +x /tmp/hadolint
63+
sudo mv /tmp/hadolint /usr/local/bin/hadolint
64+
- name: Run hadolint
65+
run: make lint-dockerfiles

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,14 @@ format-md: ## Format all markdown files to wrap at 80 characters
9595
lint: ## Run linter (clippy)
9696
cargo clippy --all-targets -- -D warnings --allow clippy::mutable_key_type
9797

98+
.PHONY: lint-dockerfiles
99+
lint-dockerfiles: ## Check all Dockerfiles using hadolint
100+
@if [ "$$GITHUB_ACTIONS" = "true" ]; then \
101+
find . -name "Dockerfile*" -type f -exec hadolint {} \;; \
102+
else \
103+
find . -name "Dockerfile*" -type f -exec sh -c 'docker run --rm -i hadolint/hadolint < "$$1"' _ {} \;; \
104+
fi
105+
98106
.PHONY: setup-wasm-toolchain
99107
setup-wasm-toolchain: ## Setup the WebAssembly toolchain, using nightly
100108
@ARCH=$$(uname -m); \

0 commit comments

Comments
 (0)