forked from t3-oss/create-t3-turbo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (80 loc) · 2.76 KB
/
Makefile
File metadata and controls
103 lines (80 loc) · 2.76 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Makefile for simplified Docker infrastructure setup
.PHONY: help
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: git-hooks
git-hooks:
git config core.hooksPath .githooks
# ========== Development Commands ==========
.PHONY: start
start: ## Start infrastructure and run turbo dev (recommended)
docker-compose up -d && pnpm dev
.PHONY: infra
infra: ## Start only infrastructure services (PostgreSQL + Redis)
docker-compose up -d
.PHONY: infra-logs
infra-logs: ## Show infrastructure logs
docker-compose logs -f
# ========== Database Commands ==========
.PHONY: db-push
db-push: ## Push database schema
pnpm db:push
.PHONY: db-studio
db-studio: ## Open Drizzle Studio
pnpm db:studio
.PHONY: db-reset
db-reset: ## Reset database (WARNING: destructive)
docker-compose down -v
docker-compose up -d postgres
sleep 10
pnpm db:push
# ========== Utility Commands ==========
.PHONY: ps
ps: ## Show running containers
docker-compose ps
.PHONY: down
down: ## Stop infrastructure services
docker-compose down
.PHONY: clean
clean: ## Stop services and remove volumes (WARNING: data loss)
docker-compose down -v
.PHONY: prune
prune: ## Remove all unused Docker resources
docker system prune -af --volumes
# ========== CI Commands ==========
.PHONY: ci-build-nextjs
ci-build-nextjs: ## Build Next.js for CI
docker build -f apps/nextjs/Dockerfile \
--build-arg SOPS_KMS_KEY="$(SOPS_KMS_KEY)" \
--tag voytravel-nextjs:latest .
.PHONY: ci-build-api
ci-build-api: ## Build Python API for CI
docker build -f apps/travel-assistant-api/Dockerfile \
--build-arg ENV=production \
--build-arg SOPS_KMS_KEY="$(SOPS_KMS_KEY)" \
--tag voytravel-api:latest .
.PHONY: test-build
test-build: ## Test production builds locally
$(MAKE) ci-build-nextjs
$(MAKE) ci-build-api
@echo "✅ Production builds completed successfully!"
# ========== Env File Commands =============
.PHONY: env-decrypt-dev
env-decrypt-dev:
@[ -f apps/nextjs/.env.development.sops ] || { echo "No apps/nextjs/.env.development.sops"; exit 1; }
sops -d apps/nextjs/.env.development.sops > apps/nextjs/.env.development
.PHONY: env-encrypt-dev
env-encrypt-dev:
@[ -f apps/nextjs/.env.development ] || { echo "No apps/nextjs/.env.development"; exit 1; }
sops -e -i apps/nextjs/.env.development
.PHONY: env-decrypt-prod
env-decrypt-prod:
@[ -f apps/nextjs/.env.production.sops ] || { echo "No apps/nextjs/.env.production.sops"; exit 1; }
sops -d apps/nextjs/.env.production.sops > apps/nextjs/.env.production
.PHONY: env-decrypt-prod
env-encrypt-prod:
@[ -f apps/nextjs/.env.production ] || { echo "No apps/nextjs/.env.production"; exit 1; }
sops -e -i apps/nextjs/.env.production