-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
80 lines (66 loc) · 2.02 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
# ___________________________________________________________________________
#
# Jesse Palmerio - March 2020
#
# Makefile used to simplify work with docker images
# The base image has the necessary python packages and fortran libraries
# installed (to avoid rebuilding which takes a while)
# The core image has the LGRB population code installed on top of the
# base image
# ___________________________________________________________________________
VERSION=0.1
BASE_IMG=lgrbpop_base:${VERSION}
CORE_IMG=lgrbpop_core:${VERSION}
FULL_IMG=lgrbpop:${VERSION}
CONT_NAME=lgrbpop_container
STACK_NAME=lgrbpop
.PHONY: base_img core bashrun deploy clean log
base_img:
@echo '--'
@echo 'Docker build base image from base_img_Dockerfile'
@echo '--'
@docker build --tag=${BASE_IMG} -f base_img/base_img_Dockerfile .
@afplay /System/Library/Sounds/Morse.aiff -v 10
core:
@echo '--'
@echo 'Docker build core image without cache from Dockerfile ${PWD}'
@echo '--'
@docker build --no-cache --rm --tag=${CORE_IMG} --build-arg BASE_IMAGE=${BASE_IMG} .
bashrun:
@echo '--'
@echo 'Docker run ${CORE_IMG} in container: ${CONT_NAME}'
@echo '--'
@docker run --rm -it --entrypoint=bash --name=${CONT_NAME} ${CORE_IMG}
deploy:
@echo '--'
@echo 'Docker stack deployment'
@echo '--'
@docker stack deploy --with-registry-auth -c configuration.yml --prune ${STACK_NAME}
clean:
@if [ $$(docker service ls -qf name=${STACK_NAME}|wc -l) -gt 0 ]; then\
echo '--';\
echo 'Old stack cleansing';\
echo '--';\
docker stack rm ${STACK_NAME};\
fi
@while [ $$(docker ps -qf name=${STACK_NAME}|wc -l) -gt 0 ]; do\
sleep 1;\
done
@sleep 2
log:
@echo '--'
@echo 'Service log'
@echo '--'
@docker service logs ${STACK_NAME}_pipeline -f --raw
notrunc:
@echo '--'
@echo 'No trunc'
@echo '--'
@docker service ps ${STACK_NAME}_pipeline --no-trunc
coverage:
@echo '--'
@echo 'Running coverage'
@echo '--'
coverage run --source src/ -m pytest
@coverage xml -o reports/coverage.xml
#______________________________________________________________________________