-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (55 loc) · 1.98 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
# -*- 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 := django
MAIN_CONTAINER_SHELL := bash
PREVIEW_URL := http://0.0.0.0:8000/
.PHONY: ps up setup restart renew shell logs follow open hide reveal build start lint test doc generate deploy stop down clean prune help
ps: ## 監視
$(CMD_DOCKER_COMPOSE) ps
up: ## 起動
$(CMD_DOCKER_COMPOSE) up --detach --remove-orphans
migrate: ## 移行
$(CMD_DOCKER_COMPOSE) run python manage.py migrate
setup: up ## 初回
echo "TODO: Not Implemented Yet!"
restart: stop up ; ## 再起
renew: down clean setup ; ## 転生
shell: up ## 接続
$(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) $(MAIN_CONTAINER_SHELL)
logs: ## 記録
$(CMD_DOCKER_COMPOSE) logs --timestamp
follow: ## 追跡
$(CMD_DOCKER_COMPOSE) logs --timestamps --follow
open: ## 閲覧
open ${PREVIEW_URL}
hide: ## 秘匿
git secret hide -v
reveal: ## 暴露
git secret reveal -v
# build: up ## 構築
# $(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) yarn build
# start: build ## 開始
# $(CMD_DOCKER_COMPOSE) exec --detach $(MAIN_CONTAINER_APP) yarn start
# lint: up ## 検証
# $(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) yarn lint
# test: up ## 試験
# $(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) yarn test
# doc: up ## 文書
# $(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) yarn test
# generate: up ## 生成
# $(CMD_DOCKER_COMPOSE) exec $(MAIN_CONTAINER_APP) yarn generate
deploy: generate ## 配備
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}'