-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (40 loc) · 1.64 KB
/
Copy pathMakefile
File metadata and controls
57 lines (40 loc) · 1.64 KB
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
.PHONY: help install dev build up down logs clean test lint format
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
install: ## Install dependencies
pip install -r requirements.txt
dev: ## Start development environment
docker compose -f docker/docker-compose.dev.yml up --build
build: ## Build production Docker image
docker compose -f docker/docker-compose.yml build
up: ## Start production environment
docker compose -f docker/docker-compose.yml up -d
down: ## Stop all containers
docker compose -f docker/docker-compose.yml down
docker compose -f docker/docker-compose.dev.yml down
logs: ## Show logs
docker compose -f docker/docker-compose.yml logs -f
clean: ## Remove containers, volumes, and images
docker compose -f docker/docker-compose.yml down -v --rmi all
docker compose -f docker/docker-compose.dev.yml down -v --rmi all
test: ## Run tests
pytest tests/ -v --cov=app --cov-report=html
lint: ## Run linter
ruff check .
format: ## Format code
ruff check --fix .
ruff format .
migrate: ## Run database migrations
alembic upgrade head
migrate-create: ## Create a new migration
@read -p "Enter migration message: " msg; \
alembic revision --autogenerate -m "$$msg"
shell: ## Open Python shell with app context
python -c "from app.main import app; import IPython; IPython.embed()"
db-shell: ## Open database shell
docker exec -it fastapi-postgres psql -U postgres -d fastapi_db
redis-cli: ## Open Redis CLI
docker exec -it fastapi-redis redis-cli