This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
makefile
117 lines (88 loc) · 2.76 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Need to export as ENV var
export TEMPLATE_DIR = templates
# Set up some variables for directories we'll use:
BOX_DIR = bigbox
BOX_DATA = $(BOX_DIR)/data
DOCKER_DIR = docker
REQ_DIR = $(DOCKER_DIR)
REPO = indras_net
MODELS_DIR = models
NB_DIR = notebooks
REACT_TOP = webapp
REACT_BUILD = $(REACT_TOP)/build
REACT_PUBLIC = $(REACT_TOP)/public
REACT_SRC = $(REACT_TOP)/src
REACT_MAIN = webapp.html
WEB_STATIC = static
API_DIR = APIServer
PYLINT = flake8
PYLINTFLAGS =
UTILS_DIR = utils
PTML_DIR = html_src
INCS = $(TEMPLATE_DIR)/head.txt $(TEMPLATE_DIR)/logo.txt $(TEMPLATE_DIR)/menu.txt
HTMLFILES = $(shell ls $(PTML_DIR)/*.ptml | sed -e 's/.ptml/.html/' | sed -e 's/html_src\///')
FORCE:
notebooks: $(PYTHONFILES)
cd $(NB_DIR); make notebooks
local: $(HTMLFILES) $(INCS)
%.html: $(PTML_DIR)/%.ptml $(INCS)
python3 $(UTILS_DIR)/html_checker.py $<
$(UTILS_DIR)/html_include.awk <$< >$@
git add $@
$(MODEL_REGISTRY)/%_model.json: $(MODELS_DIR)/%.py
python3 json_generator.py $< >$@
models.json: $(MODELJSON_FILES)
python3 json_combiner.py $? --models_fp $(JSON_DESTINATION)
create_dev_env: FORCE
./setup.sh .bashrc # change to .bash_profile for Mac!
git submodule init $(UTILS_DIR)
git submodule update $(UTILS_DIR)
setup_react: FORCE
cd $(REACT_TOP); npm install
# Build react files to generate static assets (HTML, CSS, JS)
webapp: $(REACT_PUBLIC)/$(REACT_MAIN)
$(REACT_PUBLIC)/$(REACT_MAIN): $(REACT_FILES)
- cd $(REACT_TOP); npm run build
mv $(REACT_BUILD)/index.html $(REACT_BUILD)/$(REACT_MAIN)
cp -r $(REACT_BUILD)/* .
# build tags file for vim:
tags: FORCE
ctags --recurse .
git add tags
submods:
cd utils; git pull origin master
# run tests then commit all, then push
# add notebooks back in as target once debugged!
prod: local github
# run tests then push just what is already committed:
prod1: tests
git push origin master
tests: jstests dockertests
dockertests:
docker build -t gcallah/$(REPO) docker/
github:
- git commit -a
git push origin master
lint: $(patsubst %.py,%.pylint,$(PYTHONFILES))
%.pylint:
$(PYLINT) $(PYLINTFLAGS) $*.py
# dev container has dev tools
dev_container: $(DOCKER_DIR)/Dockerfile $(DOCKER_DIR)/requirements.txt $(DOCKER_DIR)/requirements-dev.txt
docker build -t gcallah/$(REPO)-dev docker
# prod container has only what's needed to run
prod_container: $(DOCKER_DIR)/Deployable $(DOCKER_DIR)/requirements.txt
docker system prune -f
docker build -t gcallah/$(REPO) docker --no-cache --build-arg repo=$(REPO) -f $(DOCKER_DIR)/Deployable
# deploy prod containerr
deploy_container: prod_container
docker push gcallah/$(REPO):latest
nocrud:
-rm *~
-rm *.log
-rm *.out
-rm .*swp
-rm *.csv
-rm models/.coverage
# Build the webapp react docker image
webapp-image:
docker build -f webapp/Dockerfile.dev -t gcallah/indras_webapp webapp