-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
114 lines (74 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
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
PROJECT_USER=kaybenleroll
PROJECT_NAME=insurance-modelling
PROJECT_LABEL=latest
IMAGE_TAG=${PROJECT_USER}/${PROJECT_NAME}:${PROJECT_LABEL}
DOCKER_USER=rstudio
DOCKER_UID=$(shell id -u)
DOCKER_GID=$(shell id -g)
RSTUDIO_PORT=8787
CONTAINER_NAME=carinsmodelling
### Set GITHUB_USER with 'gh config set gh_user <<user>>'
GITHUB_USER=$(shell gh config get gh_user)
GITHUB_PROJECT="MTPL1 Modelling"
GITHUB_LABEL=modelling
GITHUB_MILESTONE="Initial Models"
### Project build targets
.SUFFIXES: .Rmd .html .dot .png
RMD_FILES := $(wildcard *.Rmd)
HTML_FILES := $(patsubst %.Rmd,%.html,$(RMD_FILES))
all-html: $(HTML_FILES)
.Rmd.html:
Rscript -e 'rmarkdown::render("$<")'
.dot.png: %.dot
dot -Tpng -o$*.png $<
full_deps.dot:
makefile2graph all-html > full_deps.dot
depgraph: full_deps.dot full_deps.png
exploring_mtpl1_dataset.html: construct_mtpl_datasets.html
exploring_mtpl2_dataset.html: construct_mtpl_datasets.html
gh-create-issue:
gh issue create \
--assignee ${GITHUB_USER} \
--project ${GITHUB_PROJECT} \
--label ${GITHUB_LABEL} \
--milestone ${GITHUB_MILESTONE}
echo-reponame:
echo "${REPO_NAME}"
clean-html:
rm -rfv *.html
clean-cache:
rm -rfv *_cache
rm -rfv *_files
mrproper:
rm -rfv *.html
rm -rfv *.dot
rm -rfv *.png
rm -rfv *_cache
rm -rfv *_files
rm -rfv data/*.rds
rm -rfv geospatial_data/*.zip
rm -rfv geospatial_data/FRA_adm*
docker-build-image: Dockerfile
docker build -t ${IMAGE_TAG} -f Dockerfile .
docker-run:
docker run --rm -d \
-p ${RSTUDIO_PORT}:8787 \
-v "${PWD}":"/home/${DOCKER_USER}/${PROJECT_NAME}":rw \
-e USER=${DOCKER_USER} \
-e PASSWORD=quickpass \
-e USERID=${DOCKER_UID} \
-e GROUPID=${DOCKER_GID} \
--name ${CONTAINER_NAME} \
${IMAGE_TAG}
docker-bash:
docker exec -it -u ${DOCKER_USER} ${CONTAINER_NAME} bash
docker-stop:
docker stop ${CONTAINER_NAME}
docker-clean:
docker rm $(shell docker ps -q -a)
docker-login:
cat $(HOME)/.dockerpass | docker login -u kaybenleroll --password-stdin
docker-pull:
docker pull ${IMAGE_TAG}
docker-push:
docker push ${IMAGE_TAG}