-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
49 lines (39 loc) · 1.41 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
IMG_NAME=ring3-dash
DATA_CON=$(IMG_NAME)-data
DASH_CON=$(IMG_NAME)
PORTS+=-p 80:80
VOLUMES+=--volumes-from $(DATA_CON) -v /etc/localtime:/etc/localtime:ro
DEV_VOL=-v $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))):/host
build: . scripts/.gh-token scripts/.jira-pw
docker build -t $(IMG_NAME) .
clean:
docker rmi $(IMG_NAME) 2>/dev/null || true
[ ! -s .gh-token ] && rm -f .gh-token
stop:
docker rm -f $(DASH_CON) 2>/dev/null || true
run: build data stop
docker run --name=$(DASH_CON) -d -ti $(VOLUMES) $(PORTS) $(IMG_NAME)
shell: run
docker exec -it `docker ps -q -f name=$(DASH_CON)` /bin/bash
data: build
docker run --name=$(DATA_CON) -ti $(IMG_NAME) true 2>/dev/null || true
purge: stop
@read -n1 -r -p "This will remove all persistent data. Are you sure? " ;\
echo ;\
if [ "$$REPLY" == "y" ]; then \
docker rm -f $(DATA_CON) 2>/dev/null || true; \
fi
check: build
docker run --rm -it $(DEV_VOL) $(IMG_NAME) bash -c "cd /host; pep8 --show-source --show-pep8 /host/scripts/*.py"
docker run --rm -it $(DEV_VOL) $(IMG_NAME) bash -c "cd /host; pylint scripts/*.py"
docker run --rm -it $(DEV_VOL) $(IMG_NAME) jsonlint /host/grafana/dash.json
scripts/.gh-token scripts/.jira-pw:
@if [ ! -s $@ ]; then \
read -n1 -r -p "$@ does not exist, create dummy token? "; echo; \
if [ "$$REPLY" != "y" ]; then \
echo "Aborting"; \
exit 2; \
fi \
fi
@touch $@
.PHONY: build clean stop run shell data purge check