-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
67 lines (46 loc) · 1.58 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
.PHONY: clean build up down restart logs prune migrate test help
# Default target
.DEFAULT_GOAL := help
# Variables
DC := docker compose
# Colors for help message
YELLOW := \033[33m
RESET := \033[0m
help: ## Show this help message
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*##"; printf "\n"} /^[a-zA-Z_-]+:.*?##/ { printf " $(YELLOW)%-15s$(RESET) %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
clean: ## Stop containers, remove volumes, and prune system
$(DC) down -v
docker system prune -f
build: ## Rebuild the containers without using cache
$(DC) build --no-cache
up: ## Start the application in the foreground
$(DC) up
up-d: ## Start the application in the background
$(DC) up -d
down: ## Stop the application
$(DC) down
restart: down up ## Restart the application
logs: ## Show logs from all containers
$(DC) logs -f
prune: ## Remove all unused containers, networks, images (both dangling and unreferenced), and volumes
docker system prune -a --volumes -f
ps: ## List running containers
$(DC) ps
migrate: ## Run database migrations
$(DC) exec api bun run db:migrate
shell: ## Open a shell in the api container
$(DC) exec api /bin/sh
test: ## Run tests
$(DC) exec api bun run test
rebuild: clean build up ## Clean everything, rebuild, and start the application
# Development specific commands
dev-build: ## Build for development
$(DC) -f docker-compose.dev.yml build
dev-up: ## Start the application in development mode
$(DC) -f docker-compose.dev.yml up
dev-down: ## Stop the development environment
$(DC) -f docker-compose.dev.yml down