-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (58 loc) · 2.02 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -*- coding: utf-8 -*-
TIMESTAMP := $(shell date +%Y%m%d%H%M%S)
MAKEFILE_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
CMD_DOCKER := docker
CMD_DOCKER_COMPOSE := docker compose
MAIN_CONTAINER_APP := app
MAIN_CONTAINER_SHELL := bash
PREVIEW_URL := http://0.0.0.0:8000/
.DEFAULT_GOAL := default
.PHONY: default setup ps build up renew shell logs follow open hide reveal start format lint test doc deploy stop down clean prune help
default: start # 常用
@say "The application has been started."
make open
make follow
setup: reveal up ; ## 初回
echo "TODO: Not Implemented Yet!"
ps: ## 状況
$(CMD_DOCKER_COMPOSE) ps --all
build: ## 構築
$(CMD_DOCKER_COMPOSE) build
up: build ## 起動
$(CMD_DOCKER_COMPOSE) up --detach --remove-orphans
renew: down clean build ; ## 転生
$(CMD_DOCKER_COMPOSE) up --detach --remove-orphans --force-recreate
shell: up ## 接続
$(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) $(MAIN_CONTAINER_SHELL)
logs: ## 記録
$(CMD_DOCKER_COMPOSE) logs --timestamps
follow: ## 追跡
$(CMD_DOCKER_COMPOSE) logs --timestamps --follow
open: ## 閲覧
open ${PREVIEW_URL}
hide: ## 秘匿
git secret hide -v
reveal: ## 暴露
git secret reveal -vf
start: up ## 開始
$(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) pipenv run start
format: ##
$(CMD_DOCKER_COMPOSE) run $(MAIN_CONTAINER_APP) pipenv run format
lint: format ## 検証
$(CMD_DOCKER_COMPOSE) run $(MAIN_CONTAINER_APP) pipenv run lint
test: ## 試験
$(CMD_DOCKER_COMPOSE) run $(MAIN_CONTAINER_APP) pipenv run test
doc: format ## 文書
$(CMD_DOCKER_COMPOSE) run $(MAIN_CONTAINER_APP) pipenv run doc
deploy: ## 配備
echo "TODO: Not Implemented Yet!"
stop: ## 停止
$(CMD_DOCKER_COMPOSE) stop
down: ## 削除
$(CMD_DOCKER_COMPOSE) down --rmi all --remove-orphans
clean: down ## 掃除
rm -rf log/*
prune: ## 破滅
$(CMD_DOCKER) system prune --all --force --volumes
help: ## 助言
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'