-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
200 lines (168 loc) · 6.04 KB
/
Makefile
File metadata and controls
200 lines (168 loc) · 6.04 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# Filecoin Antithesis Docker Build Makefile
# ==========================================
-include versions.env
# Git tags/commits for each image
drand_tag = $(shell git ls-remote --tags https://github.com/drand/drand.git | grep -E 'refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$$' | tail -n1 | sed 's/.*refs\/tags\///')
lotus_tag = $(shell git ls-remote https://github.com/filecoin-project/lotus.git HEAD | cut -f1)
curio_tag = $(shell git ls-remote https://github.com/filecoin-project/curio.git refs/heads/pdpv0 | cut -f1)
forest_commit = $(shell git ls-remote https://github.com/ChainSafe/forest.git HEAD | cut -f1)
# Docker configuration
builder = docker
BUILD_CMD = docker build
# Architecture configuration
TARGET_ARCH ?= $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
DOCKER_PLATFORM = linux/$(TARGET_ARCH)
# Build mode: "local" uses local images, "remote" uses Antithesis registry
BUILD_MODE ?= local
# ==========================================
# Show version info
# ==========================================
.PHONY: show-versions
show-versions:
@echo "Image versions:"
@echo " Drand: $(drand_tag)"
@echo " Lotus: $(lotus_tag)"
@echo " Forest: $(forest_commit)"
@echo " Curio: $(curio_tag)"
@echo " Arch: $(TARGET_ARCH)"
.PHONY: show-drand-tag
show-drand-tag:
@echo "Drand tag: $(drand_tag)"
.PHONY: show-lotus-tag
show-lotus-tag:
@echo "Lotus tag: $(lotus_tag)"
.PHONY: show-forest-commit
show-forest-commit:
@echo "Forest commit: $(forest_commit)"
.PHONY: show-curio-tag
show-curio-tag:
@echo "Curio tag: $(curio_tag)"
.PHONY: show-arch
show-arch:
@echo "Current target architecture: $(TARGET_ARCH)"
@echo "Docker platform: $(DOCKER_PLATFORM)"
# ==========================================
# Build individual images
# ==========================================
.PHONY: build-drand
build-drand:
@echo "Building drand for $(TARGET_ARCH)..."
@echo " Git tag: $(drand_tag)"
$(BUILD_CMD) --build-arg=GIT_BRANCH=$(drand_tag) -t drand:latest -f drand/Dockerfile drand
.PHONY: build-lotus
build-lotus:
@echo "Building lotus for $(TARGET_ARCH)..."
@echo " Git commit: $(lotus_tag)"
$(BUILD_CMD) --build-arg=GIT_BRANCH=$(lotus_tag) -t lotus:latest -f lotus/Dockerfile lotus
.PHONY: build-forest
build-forest:
@echo "Building forest for $(TARGET_ARCH)..."
@echo " Git commit: $(forest_commit)"
$(BUILD_CMD) --build-arg GIT_COMMIT=$(forest_commit) -t forest:latest -f forest/Dockerfile forest
.PHONY: build-curio
build-curio:
@echo "Building curio for $(TARGET_ARCH)..."
@echo " Git commit: $(curio_tag)"
@echo " Build mode: $(BUILD_MODE)"
$(BUILD_CMD) --build-arg=GIT_BRANCH=$(curio_tag) --build-arg=LOTUS_TAG=$(lotus_tag) --build-arg=BUILD_MODE=$(BUILD_MODE) -t curio:latest -f curio/Dockerfile curio
.PHONY: build-workload
build-workload:
@echo "Building workload for $(TARGET_ARCH)..."
$(BUILD_CMD) -t workload:latest -f workload/Dockerfile workload
.PHONY: build-filwizard
build-filwizard:
@echo "Building filwizard for $(TARGET_ARCH)..."
$(BUILD_CMD) -t filwizard:latest -f filwizard/Dockerfile filwizard
# ==========================================
# Compose commands
# ==========================================
.PHONY: up
up:
$(builder) compose up -d
.PHONY: up-full
up-full:
$(builder) compose --profile full up -d
.PHONY: up-foc
up-foc:
$(builder) compose --profile foc up -d
.PHONY: down
down:
$(builder) compose down
.PHONY: down-full
down-full:
$(builder) compose --profile full down
.PHONY: down-foc
down-foc:
$(builder) compose --profile foc down
.PHONY: logs
logs:
$(builder) compose logs -f
.PHONY: restart
restart:
$(builder) compose restart
# ==========================================
# Build groups
# ==========================================
.PHONY: build-infra
build-infra: build-drand
@echo "Infrastructure images built."
.PHONY: build-nodes
build-nodes: build-lotus build-forest build-curio
@echo "Node images built."
.PHONY: build-all
build-all: build-drand build-lotus build-forest build-curio build-workload build-filwizard
@echo "All images built."
# ==========================================
# Full workflows
# ==========================================
.PHONY: all
all: build-all up
@echo "All images built and localnet started."
.PHONY: rebuild
rebuild: down cleanup build-all up
@echo "Clean rebuild complete."
.PHONY: rebuild-foc
rebuild-foc: down-foc cleanup build-all up-foc
@echo "Clean rebuild (FOC) complete."
.PHONY: cleanup
cleanup:
$(builder) compose down 2>/dev/null || true
./cleanup.sh
# ==========================================
# Help
# ==========================================
.PHONY: help
help:
@echo "Filecoin Antithesis Makefile"
@echo ""
@echo "Build individual images:"
@echo " make build-drand Build drand image"
@echo " make build-lotus Build lotus image"
@echo " make build-forest Build forest image"
@echo " make build-curio Build curio image"
@echo " make build-filwizard Build filwizard image"
@echo " make build-workload Build workload image"
@echo ""
@echo "Build groups:"
@echo " make build-infra Build infrastructure (drand)"
@echo " make build-nodes Build all node images (lotus, forest, curio)"
@echo " make build-all Build all images"
@echo ""
@echo "Docker Compose:"
@echo " make up Start all default services (drand + lotus + miners + forest + workload)"
@echo " make up-foc Start all + FOC services (curio + filwizard + yugabyte)"
@echo " make down Stop all default services"
@echo " make down-foc Stop all services including FOC"
@echo " make logs Follow logs (docker compose logs -f)"
@echo " make restart Restart all containers"
@echo ""
@echo "Workflows:"
@echo " make all Build all images and start localnet"
@echo " make rebuild Clean rebuild (down + cleanup + build + up)"
@echo " make cleanup Stop containers and clean data"
@echo ""
@echo "Info:"
@echo " make show-versions Show all image version tags"
@echo " make show-arch Show target architecture"
@echo ""
@echo "Current arch: $(TARGET_ARCH)"