-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
52 lines (41 loc) · 1.36 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
.PHONY: docker .docker-subtarget symlinks clean
docker: docker-build.log
docker tag tripleee/halflife tripleee/halflife:latest
docker push tripleee/halflife:latest
docker-build.log: Dockerfile halflife.py halflife.conf websocketd test
# Check that we are logged in to Docker, so that push can work
# https://stackoverflow.com/a/36023944
awk '/"auths"/ { auth=1 } \
/^[[:space:]]*\}/ { auth=0 } \
auth && /"https:\/\/index\.docker\.io\/v1\/":/ { \
status=1; exit 0 } \
END { if (!status) \
print "No Docker cookie found" >"/dev/stderr";\
exit 1-status }' ~/.docker/config.json
# Check that we don't have unpushed commits
! git log --oneline @{u}.. | grep .
-awk 'END { print $$NF }' $@ | xargs docker rmi
docker build -t tripleee/halflife --progress=plain --no-cache . 2>&1 \
| tee $@
websocketd: ../websocketd-alpine/websocketd
cp $< $@
.PHONY: test
test: hlenv
./hlenv/bin/python ./nst.py nst.json
hlenv: requirements.txt
$(RM) -r $@
python3 -m venv $@
$@/bin/pip install -r requirements.txt
SYMLINKS := blacklisted_websites.txt \
$(patsubst %,%_numbers.txt,watched blacklisted) \
$(patsubst %,%_keywords.txt,watched bad)
symlinks: $(SYMLINKS)
$(SYMLINKS): %: ../SmokeDetector/%
test -p $@ || ln -s $< $@
clean:
:
realclean: clean
$(RM) $(SYMLINKS)
distclean: realclean
$(RM) *.log
# Manually remove halflife.conf if you are really dramatic