-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (73 loc) · 2.22 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
92
93
94
95
96
97
# include .env file
# include example.env.global
# include example.env.mongodb
# include .env.global
# include .env.mongodb
export APP=apiviz-back-only
export D_FOLDER=docker-files
export DC_FOLDER=dockercomposes
export DF_FOLDER=dockerfiles
#other variable definition
# DC := docker-compose
# DF := Dockerfile.
export DC=docker-compose
export DF=Dockerfile.
export DC_PREFIX= $(shell pwd)/${DC}
export DC_PREFIX_FOLDER= $(shell pwd)/${D_FOLDER}/${DC_FOLDER}/${DC}
export DC_FOLDER_SUBPATH= ${D_FOLDER}/${DC_FOLDER}
export DF_FOLDER_SUBPATH= ${D_FOLDER}/${DF_FOLDER}
export APP_PATH := $(shell pwd)
export BACKEND=${APP_PATH}
export FRONTEND=${APP_PATH}
# this is usefull with most python apps in dev mode because if stdout is
# buffered logs do not shows in realtime
PYTHONUNBUFFERED=1
export PYTHONUNBUFFERED
### ============ ###
### network
### ============ ###
network-stop:
docker network rm ${APP}
network:
@docker network create ${APP} 2> /dev/null; true
### ============ ###
### nginx
### ============ ###
nginx:
${DC} -f ${DC_PREFIX_FOLDER}-nginx.yml up --build
nginx-stop:
${DC} -f ${DC_PREFIX_FOLDER}-nginx.yml down
### ============ ###
### backend
### ============ ###
# ------------------
# default - dev
backend-gunicorn-dev:
${DC} -f ${DC_PREFIX_FOLDER}-backend-gunicorn-dev.yml up --build
backend-gunicorn-dev-stop:
${DC} -f ${DC_PREFIX_FOLDER}-backend-gunicorn-dev.yml down
# default - prod
backend-gunicorn-prod:
${DC} -f ${DC_PREFIX_FOLDER}-backend-gunicorn-prod.yml up --build -d
backend-gunicorn-prod-stop:
${DC} -f ${DC_PREFIX_FOLDER}-backend-gunicorn-prod.yml down
### ============================= ###
### main make / docker commands
### ============================= ###
# --------------------
# # default - dev
# up: network backend-gunicorn-dev
# down: backend-gunicorn-dev-stop network-stop
# restart: down up
# # default - prod
# up-prod: network backend-gunicorn-prod
# down-prod: backend-gunicorn-prod-stop network-stop
# restart-prod: down-prod up-prod
# default - dev
up: network backend-gunicorn-dev
down: backend-gunicorn-dev-stop network-stop
restart: down up
# default - prod
up-prod: network backend-gunicorn-prod
down-prod: backend-gunicorn-prod-stop network-stop
restart-prod: down-prod up-prod