Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (67 loc) · 2.66 KB
/
Copy pathMakefile
File metadata and controls
99 lines (67 loc) · 2.66 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
# Makefile for devbox
# Load .env file if present (silently skip if not found)
-include .env
export
# Tool binaries
CARGO ?= cargo
DOCKER ?= docker
# Docker image configuration
IMAGE_NAME ?= devbox
IMAGE_TAG ?= latest
.PHONY: all build test run run-agent run-server clean help docker-build docker-run css-dev css-build fmt lint check hooks bake-cli bake-server bake-agent bake-all
all: build
##@ Build
build: css-build ## Build the devbox binaries (includes CSS)
$(CARGO) build --release
##@ Development
css-dev: ## Watch and rebuild CSS (requires tailwindcss CLI)
cd crates/devbox-server && tailwindcss -i styles/input.css -o static/css/output.css --watch
css-build: ## Build minified CSS for production
cd crates/devbox-server && tailwindcss -i styles/input.css -o static/css/output.css --minify
run-server: css-build ## Run the devbox server locally (loads .env if present)
RUST_LOG=info,devbox_server=debug $(CARGO) run --bin devbox-server -- ${ARGS}
run: ARGS = --help
run: ## Run the devbox CLI (pass args via ARGS, e.g. make run ARGS="list")
$(CARGO) run --bin devbox -- ${ARGS}
run-agent: ARGS = --help
run-agent: ## Run the devbox agent (pass args via ARGS, e.g. make run-agent ARGS="principals dev")
$(CARGO) run --bin devbox-agent -- ${ARGS}
fmt: ## Format code
$(CARGO) fmt --all
lint: ## Run clippy lints
$(CARGO) clippy --all-targets --all-features -- -D warnings
check: ## Run cargo check
$(CARGO) check
hooks: ## Install prek git hooks (pre-commit + pre-push)
prek install
##@ Testing
test: ## Run unit tests
$(CARGO) test --all-features
##@ Docker
docker-build: ## Build Docker image
$(DOCKER) build -t $(IMAGE_NAME):$(IMAGE_TAG) .
docker-run: ## Run Docker container locally
$(DOCKER) run --rm -it \
-p 3000:3000 \
-e DATABASE_URL=sqlite:/data/devbox.db?mode=rwc \
-e RUST_LOG=debug \
-v devbox-data:/data \
$(IMAGE_NAME):$(IMAGE_TAG)
##@ Docker Bake (musl builds)
bake-cli: ## Build CLI musl binary via Docker Bake
$(DOCKER) buildx bake cli
bake-server: ## Build Server musl binary via Docker Bake
$(DOCKER) buildx bake server
bake-agent: ## Build Agent musl binary via Docker Bake
$(DOCKER) buildx bake agent
bake-all: ## Build all musl binaries via Docker Bake
$(DOCKER) buildx bake ci
##@ Cleanup
clean: ## Clean build artifacts
$(CARGO) clean
docker-clean: ## Remove Docker images
$(DOCKER) rmi $(IMAGE_NAME):$(IMAGE_TAG) || true
$(DOCKER) volume rm devbox-data || true
##@ Help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)