-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
91 lines (75 loc) · 2.23 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
VERSION=1.0
LOADER_IMAGE_TAG=impulsogov/simulacovid:$(VERSION)-loader
SERVER_IMAGE_TAG=impulsogov/simulacovid:$(VERSION)-server
build-and-run-all: loader-build-run server-build-run
# LOADER
loader-remove:
docker rm -f datasource-loader 2>/dev/null || true
# Build image
loader-build: loader-remove
docker build \
-f loader.dockerfile \
-t $(LOADER_IMAGE_TAG) .
# Run for production environment
loader-run: loader-remove
touch $(PWD)/.env
chmod +x $(PWD)/src/loader/*.sh
docker run -it --rm \
--name datasource-loader \
-v "$(PWD)/.env:/app/.env:ro" \
-v "$(PWD)/src/loader:/app/src/:ro" \
-v "datasource:/output" \
$(LOADER_IMAGE_TAG)
# DEBUGGING Run for dev environment
loader-run-shell: loader-remove
docker run --rm -it \
--entrypoint "/bin/bash" \
-v "$(PWD)/.env:/app/.env:ro" \
-v "$(PWD)/src/loader:/app/src/:ro" \
-v "datasource:/output" \
$(LOADER_IMAGE_TAG)
# Groups
loader-build-run: loader-build loader-run
loader-shell: loader-build loader-run-shell
# SERVER
server-remove:
docker rm -f datasource-server 2>/dev/null || true
# Build image
server-build: server-remove
docker build \
-f server.dockerfile \
-t $(SERVER_IMAGE_TAG) .
# PROD: Run for production environment
server-run: server-remove
docker run -d --restart=unless-stopped \
--name datasource-server \
-p 7000:7000 \
-v "datasource:/output" \
$(SERVER_IMAGE_TAG)
# DEBUGGING: Run for dev environment
server-run-shell: server-remove
docker run --rm -it \
--entrypoint "/bin/bash" \
-p 7000:7000 \
-v "datasource:/output" \
$(SERVER_IMAGE_TAG)
# LOCAL: Running in a common network with the apps
server-run-local: server-remove
docker run -d --restart=unless-stopped \
--net=my-network \
--name datasource-server \
-p 7000:7000 \
-v "datasource:/output" \
$(SERVER_IMAGE_TAG)
create-network:
docker network create -d bridge my-network || true
# Groups
server-build-local: create-network server-build server-run-local
server-build-run: server-build server-run
server-shell: server-build server-run-shell
# ANALYSIS VENV
loader-create-env-analysis:
virtualenv .loader-anaylsis
source .loader-anaylsis/bin/activate; \
pip3 install --upgrade -r requirements-analysis.txt; \
python -m ipykernel install --user --name=loader-anaylsis