error-pages/Makefile

30 lines
1.2 KiB
Makefile
Raw Normal View History

2020-07-08 11:12:21 +00:00
#!/usr/bin/make
# Makefile readme (ru): <http://linux.yaroslavl.ru/docs/prog/gnu_make_3-79_russian_manual.html>
# Makefile readme (en): <https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents>
SHELL = /bin/sh
2020-07-08 17:15:53 +00:00
DC_RUN_ARGS = --rm --user "$(shell id -u):$(shell id -g)"
2020-07-08 11:12:21 +00:00
APP_NAME = $(notdir $(CURDIR))
2020-07-08 17:15:53 +00:00
.PHONY : help install gen preview
2020-07-08 11:12:21 +00:00
.DEFAULT_GOAL : help
help: ## Show this help
@printf "\033[33m%s:\033[0m\n" 'Available commands'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[32m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
2020-07-08 17:15:53 +00:00
install: ## Install all dependencies
2021-04-13 13:55:03 +00:00
docker-compose run $(DC_RUN_ARGS) -w "/src/generator" node yarn install --frozen-lockfile --no-progress --non-interactive
2020-07-08 17:15:53 +00:00
gen: ## Generate error pages
2021-04-13 13:55:03 +00:00
docker-compose run $(DC_RUN_ARGS) node nodejs ./generator/generator.js -i -c ./config.json -o ./out
2020-07-08 17:15:53 +00:00
preview: ## Build docker image and start preview
2021-04-13 13:55:03 +00:00
docker build -f ./Dockerfile -t $(APP_NAME):local .
2020-07-08 17:15:53 +00:00
@printf "\n \e[30;42m %s \033[0m\n\n" 'Now open in your favorite browser <http://127.0.0.1:8081> and press CTRL+C for stopping'
2021-04-13 13:55:03 +00:00
docker run --rm -i -p 8081:8080 -e "TEMPLATE_NAME=random" $(APP_NAME):local
2020-07-08 11:12:21 +00:00
shell: ## Start shell into container with node
2021-04-13 13:55:03 +00:00
docker-compose run $(DC_RUN_ARGS) node sh