-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (53 loc) · 2.37 KB
/
Copy pathMakefile
File metadata and controls
76 lines (53 loc) · 2.37 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Docker configurations
DC = docker compose
ENV_FLAG = --env-file .env
# Docker Compose files
COMPOSE_DIR = docker_compose
LOCAL_DB_FILE = ${COMPOSE_DIR}/local.yaml
DOCKER_COMPOSE_FILE = ${COMPOSE_DIR}/docker-compose.yaml
.DEFAULT_GOAL := help
.PHONY: run-main ## Run the main bot application
run-main:
python -m src.bot.bot
.PHONY: lint ## Run code quality checks: ruff linting, formatting and pre-commit hooks
lint:
ruff format .
ruff check . --fix
pre-commit run --all-files
.PHONY: migration-apply ## Apply all pending database migrations using Alembic
migration-apply:
alembic upgrade head
.PHONY: migration-create ## Create a new database migration with autogenerated changes (set MESSAGE="description")
migration-create:
@if [ -z "$(MESSAGE)" ]; then echo "Error: MESSAGE is required"; exit 1; fi
alembic revision --autogenerate -m "$(MESSAGE)"
.PHONY: services-build ## Build and start application services with Docker Compose
services-build:
${DC} -f ${DOCKER_COMPOSE_FILE} ${ENV_FLAG} up -d --build
.PHONY: services-up ## Start application services without rebuilding
services-up:
${DC} -f ${DOCKER_COMPOSE_FILE} ${ENV_FLAG} up -d
.PHONY: services-down ## Stop all application services
services-down:
${DC} -f ${DOCKER_COMPOSE_FILE} ${ENV_FLAG} down
.PHONY: storages-clear ## Completely remove storage containers and volumes (warning: deletes all data)
storages-clear:
${DC} -f ${DOCKER_COMPOSE_FILE} ${ENV_FLAG} down --volumes --remove-orphans
.PHONY: local-up ## Start local development databases (Postgres, Redis) in detached mode
local-up:
${DC} -f ${LOCAL_DB_FILE} ${ENV_FLAG} up -d
.PHONY: local-down ## Stop local development databases
local-down:
${DC} -f ${LOCAL_DB_FILE} ${ENV_FLAG} down
.PHONY: help
help: ## Display this help message with all available commands
@echo "Usage: make [command]"
@echo ""
@echo "Docker Commands:"
@grep -E '^\.PHONY: (services-|storages-|local-)' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
@echo ""
@echo "Database Commands:"
@grep -E '^\.PHONY: migration-' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
@echo ""
@echo "Development Commands:"
@grep -E '^\.PHONY: (run-main|lint)' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'