-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
61 lines (52 loc) · 2.29 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
VIRTUALENV ?= virtualenv
NOMAD_ADDR ?= https://localhost:4646
NOMAD_CACERT ?= nomad-ca.pem
NOMAD_CLIENT_CERT ?= cli.pem
NOMAD_CLIENT_KEY ?= cli-key.pem
ifndef VERBOSE
.SILENT:
endif
.PHONY: help
help:
@echo 'Makefile to run and test the AI4EOSC Platform API '
@echo ' '
@echo 'Usage: '
@echo ' make setup generate a virtualenv and install the API inside it '
@echo ' make run execute the API service from the virtualenv '
@echo ' make develop generate a virtualenv and install the API inside it '
@echo ' in develop mode (i.e. pip install -e ) '
@echo ' make run-dev execute the API service from the virtualenv '
@echo ' in development mode (i.e. --reload) '
@echo ' make regenerate regenerate the virtualenv '
@echo ' make clean cleanup the existing virtualenv '
@echo ' '
@echo 'Environment variables: '
@echo ' VIRTUALENV: path for the virtualenv (defaults to "virtualenv") '
.PHONY: setup
setup: $(VIRTUALENV)
. $(VIRTUALENV)/bin/activate; cd $(VIRTUALENV); pip uninstall -y ai4papi
. $(VIRTUALENV)/bin/activate; pip install .
.PHONY: develop
develop: $(VIRTUALENV)
. $(VIRTUALENV)/bin/activate; cd $(VIRTUALENV); pip uninstall -y ai4papi
. $(VIRTUALENV)/bin/activate; pip install -e .
#.PHONY: develop
#develop: requirements.txt virtualenv install
#
regenerate: | clean $(VIRTUALENV)
$(VIRTUALENV): requirements.txt
@echo 'D> Creating $(VIRTUALENV)...'
virtualenv --python=python3 $(VIRTUALENV)
. $(VIRTUALENV)/bin/activate; pip install -r requirements.txt
.PHONY: clean
clean:
@echo 'D> Deleting $(VIRTUALENV)...'
rm -rf $(VIRTUALENV)
.PHONY: run
run: setup $(VIRTUALENV)
@echo 'D> Running AI4papi inside $(VIRTUALENV)'
. $(VIRTUALENV)/bin/activate; uvicorn ai4papi.main:app
.PHONY: run-dev
run-dev: develop $(VIRTUALENV)
@echo 'D> Running AI4papi inside $(VIRTUALENV) in development mode'
. $(VIRTUALENV)/bin/activate; uvicorn ai4papi.main:app --reload