-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
95 lines (77 loc) · 2.29 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
86
87
88
89
90
91
92
93
94
95
# -----------------------------------------------------------------------------
# This is a makefile to build rannts website.
#
# It is assumed that you are working with virtualenv and it is possible
# to pip install.
#
# Sorry if not.
#
# -----------------------------------------------------------------------------
ROOT_DIR := "$(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))"
TARGET := "$(CURDIR)/output"
NODE_DIR := "$(ROOT_DIR)/node_modules"
NCU := "$(NODE_DIR)/npm-check-updates/bin/ncu"
GULP_FLAG := gulp
DOCKER_IMAGE := rannts
DOCKER_PORT := 5000
# -----------------------------------------------------------------------------
all: server
dependencies: python node
clean_all: clean docker_clean
server: dependencies
@cd "$(ROOT_DIR)" && \
lektor server
server_all: dependencies
@cd "$(ROOT_DIR)" && \
lektor server -f "$(GULP_FLAG)" -h 0.0.0.0
build:
@cd "$(ROOT_DIR)" && \
rm -rf "$(TARGET)" && \
lektor build --no-prune -f "$(GULP_FLAG)" -O "$(TARGET)"
deploy: clean dependencies
@cd "$(ROOT_DIR)" && \
lektor build -f "$(GULP_FLAG)" && \
lektor deploy production
docker_build:
@docker run \
-i \
-t \
--rm=true \
-v "$(ROOT_DIR)":/rannts \
-e UID=$(shell id -u) \
-w /rannts \
"$(DOCKER_IMAGE)" \
/go sh -c 'make dependencies && make clean && make build'
docker_server:
@docker run \
-i \
-t \
--rm=true \
-v "$(ROOT_DIR)":/rannts \
-e UID=$(shell id -u) \
-w /rannts \
-p 5000:$(DOCKER_PORT) \
"$(DOCKER_IMAGE)" \
/go sh -c 'make dependencies && make clean && make server_all'
docker_create:
@cd "$(ROOT_DIR)" && \
docker build --rm=true --pull -t "$(DOCKER_IMAGE)" .
docker_clean: docker_clean_containers
@docker images -a -q "$(DOCKER_IMAGE)" | xargs -r docker rmi
docker_clean_containers: docker_stop_containers
@docker ps -a -q -f ancestor="$(shell docker images -a -q $(DOCKER_IMAGE))" | xargs -r docker rm
docker_stop_containers:
@docker ps -a -q -f ancestor="$(shell docker images -a -q $(DOCKER_IMAGE))" | xargs -r docker stop
python:
@pip install -r "$(ROOT_DIR)/requirements.txt"
node:
@cd "$(ROOT_DIR)" && \
$(shell which yarn || which npm) install
node_update:
@$(NCU) -a
node_update_nbc:
@$(NCU) -at
clean:
@rm -rf "$(HOME)/.cache/lektor" && \
cd "$(ROOT_DIR)" && \
lektor clean --yes