Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
196 lines (154 loc) · 6.02 KB
/
Copy pathMakefile
File metadata and controls
196 lines (154 loc) · 6.02 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
# Define the current directory and Docker Compose command
CURRENT_DIR = .
DEV_DC = docker compose -f $(CURRENT_DIR)/docker/docker-compose.yml
# Extract the second argument from MAKECMDGOALS, defaulting to "stable" if not specified
PROFILE ?= $(word 2,$(MAKECMDGOALS))
PROFILE := $(if $(PROFILE),$(PROFILE),stable)
# NCTL image
IMAGE_NAME=interchouette/casper-nctl-2-docker
# MCP sidecar image (release line: 2.2 + latest; tip: :dev)
MCP_NAME=casper-nctl-2-docker-mcp
MCP_HUB=interchouette/casper-nctl-2-docker-mcp
MCP_GHCR_PERSONAL=ghcr.io/groussac/casper-nctl-2-docker-mcp
MCP_GHCR_WORKER=ghcr.io/interchouette/casper-nctl-2-docker-mcp
MCP_GHCR_ORG=ghcr.io/interchouette-itc/casper-nctl-2-docker-mcp
MCP_TAG=2.2
# Build the Docker image for the specified profile (default is stable)
build:
$(DEV_DC) --profile $(PROFILE) build
# Build the Docker image without using cache (for a fresh build)
build-no-cache:
$(DEV_DC) --profile $(PROFILE) build --no-cache
# Build the Docker image and start the container with logs
build-start-log: build-no-cache
$(DEV_DC) --profile $(PROFILE) up --remove-orphans
# Build the Docker image and start the container in detached mode
build-start: build
$(DEV_DC) --profile $(PROFILE) up --remove-orphans -d
# Start the container in detached mode (NCTL only)
start:
$(DEV_DC) --profile $(PROFILE) up --remove-orphans -d
# Start the container and show logs in the terminal
start-log:
$(DEV_DC) --profile $(PROFILE) up --remove-orphans
# Stop the container and clean up (NCTL profile only)
stop:
$(DEV_DC) --profile $(PROFILE) down
# NCTL profile + MCP HTTP sidecar on :8790
start-all: start mcp-http
stop-all: stop mcp-http-stop
# --- MCP sidecar ---
mcp-build:
docker build -t $(MCP_NAME):$(MCP_TAG) -t $(MCP_NAME):latest \
-t $(MCP_HUB):$(MCP_TAG) -t $(MCP_HUB):latest \
-f mcp/Dockerfile mcp
mcp-build-dev:
docker build -t $(MCP_NAME):dev -t $(MCP_HUB):dev \
-t $(MCP_GHCR_PERSONAL):dev -t $(MCP_GHCR_WORKER):dev -t $(MCP_GHCR_ORG):dev \
-f mcp/Dockerfile mcp
# Prefer Hub image; build locally if pull fails
mcp-http:
-docker pull $(MCP_HUB):$(MCP_TAG)
$(DEV_DC) --profile mcp up --remove-orphans -d nctl-mcp
mcp-http-stop:
-docker stop casper-nctl-2-docker-mcp 2>/dev/null
-docker rm casper-nctl-2-docker-mcp 2>/dev/null
# Host stdio / HTTP MCP (needs Rust toolchain)
run-mcp:
NCTL_DOCKER_ROOT="$(CURDIR)" cargo run --manifest-path mcp/Cargo.toml --quiet --
run-mcp-http:
NCTL_DOCKER_ROOT="$(CURDIR)" cargo run --manifest-path mcp/Cargo.toml --quiet -- --http --listen 127.0.0.1:8790
## MCP supply-chain / coverage (Rust crate under mcp/)
COVERAGE_IGNORE := examples/|benches/
mcp-coverage:
mkdir -p coverage
cd mcp && RUSTUP_TOOLCHAIN=stable cargo llvm-cov --locked --lcov \
--ignore-filename-regex '$(COVERAGE_IGNORE)' \
--output-path ../coverage/lcov.info
mcp-coverage-summary:
cd mcp && RUSTUP_TOOLCHAIN=stable cargo llvm-cov --locked --summary-only \
--ignore-filename-regex '$(COVERAGE_IGNORE)'
mcp-coverage-html:
mkdir -p coverage
cd mcp && RUSTUP_TOOLCHAIN=stable cargo llvm-cov --locked --html \
--ignore-filename-regex '$(COVERAGE_IGNORE)' \
--output-dir ../coverage/html
mcp-audit:
cd mcp && cargo audit
mcp-deny:
cd mcp && cargo deny check
mcp-machete:
cd mcp && cargo machete
mcp-outdated:
cd mcp && cargo outdated
# Aliases matching the shared Make kit names (MCP crate).
coverage: mcp-coverage
coverage-summary: mcp-coverage-summary
coverage-html: mcp-coverage-html
audit: mcp-audit
deny: mcp-deny
machete: mcp-machete
outdated: mcp-outdated
mcp-docker-push-hub:
docker push $(MCP_HUB):$(MCP_TAG)
docker push $(MCP_HUB):latest
mcp-docker-push-ghcr-personal:
docker tag $(MCP_HUB):$(MCP_TAG) $(MCP_GHCR_PERSONAL):$(MCP_TAG)
docker tag $(MCP_HUB):latest $(MCP_GHCR_PERSONAL):latest
docker push $(MCP_GHCR_PERSONAL):$(MCP_TAG)
docker push $(MCP_GHCR_PERSONAL):latest
mcp-docker-push-ghcr-itc:
docker tag $(MCP_HUB):$(MCP_TAG) $(MCP_GHCR_WORKER):$(MCP_TAG)
docker tag $(MCP_HUB):latest $(MCP_GHCR_WORKER):latest
docker tag $(MCP_HUB):$(MCP_TAG) $(MCP_GHCR_ORG):$(MCP_TAG)
docker tag $(MCP_HUB):latest $(MCP_GHCR_ORG):latest
docker push $(MCP_GHCR_WORKER):$(MCP_TAG)
docker push $(MCP_GHCR_WORKER):latest
docker push $(MCP_GHCR_ORG):$(MCP_TAG)
docker push $(MCP_GHCR_ORG):latest
mcp-docker-push-dev-hub:
docker push $(MCP_HUB):dev
mcp-docker-push-dev-ghcr-personal:
docker push $(MCP_GHCR_PERSONAL):dev
mcp-docker-push-dev-ghcr-itc:
docker push $(MCP_GHCR_WORKER):dev
docker push $(MCP_GHCR_ORG):dev
# Start the Docker container based on the specified profile (e.g. stable, 2.2, dev)
start-docker:
docker run --rm -it ${IMAGE_NAME}:$(PROFILE)
# Host path for Docker bind mounts (MCP must set this to the host clone; not /workspace).
HOST_ROOT := $(or $(NCTL_HOST_ROOT),$(CURDIR))
# List of ports to expose
DOCKER_PORTS = \
-p 11101-11105:11101-11105 \
-p 14101-14105:14101-14105 \
-p 18101-18105:18101-18105 \
-p 25101-25105:25101-25105 \
-p 28101-28105:28101-28105
# Common Docker volume mappings (host paths — never MCP /workspace)
DOCKER_VOLUMES = \
-v $(HOST_ROOT)/assets/faucet:/app/casper-nctl/assets/net-1/faucet \
-v $(HOST_ROOT)/assets/users:/app/casper-nctl/assets/net-1/users \
-v $(HOST_ROOT)/assets/chainspec:/app/casper-nctl/assets/net-1/chainspec \
-v $(HOST_ROOT)/assets/nodes:/app/casper-nctl/assets/net-1/nodes
# Run container based on passed version
define RUN_DOCKER
docker run --rm -it \
$(DOCKER_PORTS) \
$(DOCKER_VOLUMES) \
${IMAGE_NAME}:$1
endef
# Targets
start-docker-%:
$(call RUN_DOCKER,$*)
# Catch-all rule for unrecognized make targets
%:
@:
# Mark targets as not real files
.PHONY: build start build-start build-start-log start-docker-% \
stop start-all stop-all \
mcp-build mcp-build-dev mcp-http mcp-http-stop run-mcp run-mcp-http \
mcp-docker-push-hub mcp-docker-push-ghcr-personal mcp-docker-push-ghcr-itc \
mcp-docker-push-dev-hub mcp-docker-push-dev-ghcr-personal mcp-docker-push-dev-ghcr-itc \
mcp-coverage mcp-coverage-summary mcp-coverage-html mcp-audit mcp-deny mcp-machete mcp-outdated \
coverage coverage-summary coverage-html audit deny machete outdated