-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (72 loc) · 3.54 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
# environment variables for Docker container run parameters.
TOPLVL=${PWD}
SCRIPTS=${TOPLVL}/scripts
WORK=${TOPLVL}/work
ARGS=
APP_ROOT=/imdtk
CONCATS=/vos/catalogs
CONIMGS=/vos/images
CONIRODS=${APP_ROOT}/.irods
CONSCRIPTS=${APP_ROOT}/scripts
COLLECTION=JWST
ENVLOC=/etc/trhenv
EP=/bin/bash
IMG=imdtk:devel
NAME=imdtk
NET=vos_net
PROG=imdtk
SHELL=/bin/bash
STACK=vos
TARG=/imdtk
TSTIMG=imdtk:test
.PHONY: help bash cleancache cleanwork docker dockert down exec run runit runtc runte stop up watch
help:
@echo "Make what? Try: bash, cleancache, cleanwork, docker, dockert, down, run, runit, runt1, runtc, runtep, stop, up, watch"
@echo ' where:'
@echo ' help - show this help message'
@echo ' bash - run Bash in a ${PROG} container (for development)'
@echo ' cleancache - REMOVE ALL __pycache__ dirs from the project directory!'
@echo ' cleanwork - REMOVE ALL input and output files from the work directory!'
@echo ' docker - build a production container image'
@echo ' dockert - build a container image with tests (for testing)'
@echo ' down - stop the ${PROG} container, which is running in the VOS stack'
@echo ' exec - exec into running development server (CLI arg: NAME=containerID)'
@echo ' run - start a container (CLI: ARGS=args)'
@echo ' runit - run the runit program in a test container'
@echo ' runt1 - run a test/test-dir in a container (CLI: TARG=testpath)'
@echo ' runtc - run all tests and code coverage in a container'
@echo ' runtep - run a test container with alternate entrypoint (CLI: EP=entrypoint, ARGS=args)'
@echo ' stop - stop a running container'
@echo ' up - start a ${PROG} container, running in the VOS stack'
@echo ' watch - show logfile for a running container'
bash:
docker run -it --rm --network ${NET} --name ${NAME} -v ${CONCATS}:${CONCATS}:ro -v ${CONIMGS}:${CONIMGS}:ro -v ${SCRIPTS}:${CONSCRIPTS} -v ${HOME}/.irods:${CONIRODS}:ro -v ${WORK}:/work --entrypoint ${SHELL} ${TSTIMG} ${ARGS}
cleancache:
find . -name __pycache__ -print | grep -v .venv | xargs rm -rf
cleanwork:
@rm ${WORK}/*.json ${WORK}/*.pickle ${WORK}/*.sql ${WORK}/*.csv
docker:
docker build -t ${IMG} .
dockert:
docker build --build-arg TESTS=tests -t ${TSTIMG} .
down:
docker stack rm ${STACK}
exec:
docker cp .bash_env ${NAME}:${ENVLOC}
docker exec -it ${NAME} ${EP}
run:
@docker run -it --rm --network ${NET} --name ${NAME} -v ${CONCATS}:${CONCATS}:ro -v ${CONIMGS}:${CONIMGS}:ro -v ${SCRIPTS}:${CONSCRIPTS} -v ${HOME}/.irods:${CONIRODS}:ro -v ${WORK}:/work ${IMG} ${ARGS}
runit:
@docker run -it --rm --network ${NET} --name ${NAME} -v ${CONCATS}:${CONCATS}:ro -v ${CONIMGS}:${CONIMGS}:ro -v ${SCRIPTS}:${CONSCRIPTS} -v ${HOME}/.irods:${CONIRODS}:ro -v ${WORK}:/work ${TSTIMG} ${ARGS}
runtep:
@docker run -it --rm --network ${NET} --name ${NAME} -v ${CONCATS}:${CONCATS}:ro -v ${CONIMGS}:${CONIMGS}:ro -v ${SCRIPTS}:${CONSCRIPTS} -v ${HOME}/.irods:${CONIRODS}:ro -v ${WORK}:/work --entrypoint ${EP} ${TSTIMG} ${ARGS}
runt1:
docker run -it --rm --network ${NET} --name ${NAME} -v ${CONCATS}:${CONCATS}:ro -v ${CONIMGS}:${CONIMGS}:ro -v ${HOME}/.irods:${CONIRODS}:ro --entrypoint pytest ${TSTIMG} -vv ${TARG}
runtc:
docker run -it --rm --network ${NET} --name ${NAME} -v ${CONCATS}:${CONCATS}:ro -v ${CONIMGS}:${CONIMGS}:ro -v ${HOME}/.irods:${CONIRODS}:ro --entrypoint pytest ${TSTIMG} -vv --cov-report term-missing --cov ${TARG}
stop:
docker stop ${NAME}
up:
docker stack deploy -c docker-compose.yml ${STACK}
watch:
docker logs -f ${NAME}