2018-02-18 18:39:38 +01:00
|
|
|
.PHONY: build
|
|
|
|
build: ## Builds all the dockerfiles in the repository.
|
2018-09-25 01:03:07 +02:00
|
|
|
@$(CURDIR)/build-all.sh
|
2018-02-18 18:39:38 +01:00
|
|
|
|
|
|
|
.PHONY: latest-versions
|
|
|
|
latest-versions: ## Checks all the latest versions of the Dockerfile contents.
|
2018-09-25 01:03:07 +02:00
|
|
|
@$(CURDIR)/latest-versions.sh
|
|
|
|
|
|
|
|
check_defined = \
|
|
|
|
$(strip $(foreach 1,$1, \
|
|
|
|
$(call __check_defined,$1,$(strip $(value 2)))))
|
|
|
|
__check_defined = \
|
|
|
|
$(if $(value $1),, \
|
|
|
|
$(error Undefined $1$(if $2, ($2))$(if $(value @), \
|
|
|
|
required by target `$@')))
|
|
|
|
|
|
|
|
.PHONY: run
|
|
|
|
run: ## Run a Dockerfile from the command at the top of the file (ex. DIR=telnet).
|
|
|
|
@:$(call check_defined, DIR, directory of the Dockefile)
|
|
|
|
@$(CURDIR)/run.sh "$(DIR)"
|
2018-02-18 18:39:38 +01:00
|
|
|
|
2018-09-25 10:21:17 +02:00
|
|
|
REGISTRY := r.j3ss.co
|
|
|
|
.PHONY: image
|
|
|
|
image: ## Build a Dockerfile (ex. DIR=telnet).
|
|
|
|
@:$(call check_defined, DIR, directory of the Dockefile)
|
2019-03-08 17:09:18 +01:00
|
|
|
docker build --rm --force-rm -t $(REGISTRY)/$(subst /,:,$(patsubst %/,%,$(DIR))) ./$(DIR)
|
2018-09-25 10:21:17 +02:00
|
|
|
|
2018-02-18 18:39:38 +01:00
|
|
|
.PHONY: test
|
2018-09-25 01:52:24 +02:00
|
|
|
test: dockerfiles shellcheck ## Runs the tests on the repository.
|
2018-09-25 00:30:35 +02:00
|
|
|
|
|
|
|
.PHONY: dockerfiles
|
2018-09-25 01:51:37 +02:00
|
|
|
dockerfiles: ## Tests the changes to the Dockerfiles build.
|
2018-09-25 01:03:07 +02:00
|
|
|
@$(CURDIR)/test.sh
|
2018-02-18 18:39:38 +01:00
|
|
|
|
2018-09-25 00:30:35 +02:00
|
|
|
# if this session isn't interactive, then we don't want to allocate a
|
|
|
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
|
|
|
# so that the user can send e.g. ^C through.
|
|
|
|
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
|
|
|
|
ifeq ($(INTERACTIVE), 1)
|
2018-09-25 01:03:07 +02:00
|
|
|
DOCKER_FLAGS += -t
|
2018-09-25 00:30:35 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: shellcheck
|
|
|
|
shellcheck: ## Runs the shellcheck tests on the scripts.
|
|
|
|
docker run --rm -i $(DOCKER_FLAGS) \
|
|
|
|
--name df-shellcheck \
|
|
|
|
-v $(CURDIR):/usr/src:ro \
|
|
|
|
--workdir /usr/src \
|
|
|
|
r.j3ss.co/shellcheck ./shellcheck.sh
|
|
|
|
|
2018-02-18 18:39:38 +01:00
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|