-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (66 loc) · 2.05 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
#
# hugo-scratch template repo / Makefile
#
#
# VARS
#
-include .env
# define standard colors
# https://gist.github.com/rsperl/d2dfe88a520968fbc1f49db0a29345b9
ifneq (,$(findstring xterm,${TERM}))
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
else
BLACK := ""
RED := ""
GREEN := ""
YELLOW := ""
LIGHTPURPLE := ""
PURPLE := ""
BLUE := ""
WHITE := ""
RESET := ""
endif
export
#
# TARGETS
#
all: info
.PHONY: info
info:
@echo -e "\n${GREEN} ${APP_NAME} / Makefile ${RESET}\n"
@echo -e "${YELLOW} make build --- build project (docker image) ${RESET}"
@echo -e "${YELLOW} make run --- run project ${RESET}"
@echo -e "${YELLOW} make log --- fetch container's log ${RESET}"
@echo -e "${YELLOW} make stop --- stop and purge project (only docker containers!) ${RESET}"
@echo -e ""
git_pull:
@echo -e "\n${YELLOW} Pulling from git repo... ${RESET}\n"
@git pull origin master
.PHONY: build
build: git_pull
@echo -e "\n${YELLOW} Building project (docker compose build)... ${RESET}\n"
@docker compose build
.PHONY: init
init:
@echo -e "\n${YELLOW} Initializing hugo site directory (${APP_NAME}/)... ${RESET}\n"
@docker run --detach --rm --volume ${PWD}/:/site ${DOCKER_IMAGE_NAME} new site ${APP_NAME}
.PHONY: run
serve:
@echo -e "\n${YELLOW} Starting project (docker compose up)... ${RESET}\n"
@docker compose up --detach --force-recreate
.PHONY: logs
logs:
@echo -e "\n${YELLOW} Fetching container's logs (CTRL-C to exit)... ${RESET}\n"
@docker logs ${DOCKER_CONTAINER_NAME} --follow
.PHONY: stop
stop:
@echo -e "\n${YELLOW} Stopping and purging project (docker compose down)... ${RESET}\n"
@docker compose down