-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.07 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
# Makefile for next-fastapi project
# Variables
PYTHON := python3
PIP := $(PYTHON) -m pip
PNPM := pnpm
UVICORN := $(PYTHON) -m uvicorn
CONCURRENTLY := $(PNPM) exec concurrently
# Python-related targets
.PHONY: fastapi-install
fastapi-install:
cd ./api && $(PIP) install -r requirements.txt
.PHONY: fastapi-dev
fastapi-dev:
$(UVICORN) api.index:app --reload --port 5328
.PHONY: fastapi-prod
fastapi-prod:
$(UVICORN) api.index:app --port 5328
# Development targets
.PHONY: next-dev
next-dev:
cd ./app && $(PNPM) run next-dev
.PHONY: dev
dev: fastapi-install
$(CONCURRENTLY) "$(MAKE) next-dev" "$(MAKE) fastapi-dev"
# Production targets
.PHONY: build
build:
cd ./app && $(PNPM) run build
.PHONY: start
start:
cd ./app && $(PNPM) run start
.PHONY: prod
prod: build fastapi-install
$(CONCURRENTLY) "$(MAKE) start" "$(MAKE) fastapi-prod"
.PHONY: prod-docker
prod-docker:
$(CONCURRENTLY) "$(MAKE) start" "$(MAKE) fastapi-prod"
# Utility targets
.PHONY: lint
lint:
cd ./app && $(PNPM) run lint
.PHONY: clean
clean:
rm -rf .next
find . -type d -name __pycache__ -exec rm -rf {} +