-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: Lint Dockerfiles | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: [ master ] | ||
paths: | ||
- 'Dockerfile*' | ||
|
||
jobs: | ||
lint-dockerfiles: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Lint the Dockerfiles | ||
run: | | ||
make lint-all |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# # Hadolint config file | ||
# # https://hadolint.github.io/hadolint/ | ||
|
||
# Failure mode | ||
failure-threshold: none | ||
no-fail: false | ||
|
||
# Output format | ||
format: tty | ||
no-color: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# # Makefile | ||
.DEFAULT_GOAL := all | ||
SHELL := /usr/bin/env sh | ||
|
||
|
||
# # # Help | ||
|
||
.PHONY: help | ||
help: | ||
@echo "Usage: make [TARGET:-all]" | ||
@echo "TARGET:" | ||
@echo " all" | ||
@echo " lint-dockerfile FILE" | ||
@echo " lint-all" | ||
|
||
|
||
# # # Default goal | ||
|
||
.PHONY: all | ||
all: lint-all | ||
$(info Done running 'make all') | ||
|
||
|
||
# # # Lint the Dockerfile | ||
|
||
.PHONY: lint-dockerfile | ||
lint-dockerfile: | ||
ifeq ($(origin FILE), undefined) | ||
@# Usage: make lint-dockerfile FILE=./Dockerfile | ||
$(error variable FILE is not set) | ||
else | ||
docker run \ | ||
--rm \ | ||
--interactive \ | ||
--network=none \ | ||
--volume="$(CURDIR)/.hadolint.yml:/.hadolint.yml:ro" \ | ||
hadolint/hadolint < $(FILE) | ||
endif | ||
|
||
|
||
.PHONY: lint-all lint-all-% | ||
lint-all: $(foreach FILE, $(wildcard $(CURDIR)/Dockerfile*), lint-all-$(notdir $(FILE))) | ||
lint-all-%: | ||
$(MAKE) lint-dockerfile FILE=$(CURDIR)/$* |