-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
69 lines (47 loc) · 2.1 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
# Makefile
# Variables
BACKEND_DIR=fastapi_backend
FRONTEND_DIR=nextjs-frontend
DOCKER_COMPOSE=docker compose
# Help
.PHONY: help
help:
@echo "Available commands:"
@awk '/^[a-zA-Z_-]+:/{split($$1, target, ":"); print " " target[1] "\t" substr($$0, index($$0,$$2))}' $(MAKEFILE_LIST)
# Backend commands
.PHONY: start-backend test-backend migrate-backend
start-backend: ## Start the backend server with FastAPI and hot reload
cd $(BACKEND_DIR) && ./start.sh
test-backend: ## Run backend tests using pytest
cd $(BACKEND_DIR) && poetry run pytest
# Frontend commands
.PHONY: start-frontend test-frontend
start-frontend: ## Start the frontend server with pnpm and hot reload
cd $(FRONTEND_DIR) && ./start.sh
test-frontend: ## Run frontend tests using npm
cd $(FRONTEND_DIR) && pnpm run test
# Docker commands
.PHONY: docker-backend-shell docker-frontend-shell build-backend-container build-frontend-container \
up-backend-container up-frontend-container
docker-backend-shell: ## Access the backend container shell
$(DOCKER_COMPOSE) run --rm backend sh
docker-frontend-shell: ## Access the frontend container shell
$(DOCKER_COMPOSE) run --rm frontend sh
docker-build-backend: ## Build the backend container with no cache
docker build backend --no-cache
docker-build-frontend: ## Build the frontend container with no cache
docker build frontend --no-cache
docker-up-backend: ## Start the backend container
$(DOCKER_COMPOSE) up backend
docker-up-frontend: ## Start the frontend container
$(DOCKER_COMPOSE) up frontend
docker-up-test-db: ## Start the test database container
$(DOCKER_COMPOSE) up db_test
docker-migrate-db: ## Run database migrations using Alembic
$(DOCKER_COMPOSE) run --rm backend alembic upgrade head
docker-db-schema: ## Generate a new migration schema. Usage: make docker-db-schema migration_name="add users"
$(DOCKER_COMPOSE) run --rm backend alembic revision --autogenerate -m "$(migration_name)"
docker-test-backend: ## Run tests for the backend
$(DOCKER_COMPOSE) run --rm backend pytest
docker-test-frontend: ## Run tests for the frontend
$(DOCKER_COMPOSE) run --rm frontend pnpm run test