@@ -5,10 +5,14 @@ description:
55 ToolHive.
66---
77
8- This guide covers advanced CI/CD patterns for production environments using
9- ToolHive's [ ` thv build ` ] ( ../reference/cli/thv_build.md ) command. These patterns
10- include multi-architecture builds, supply chain security, and efficient change
11- detection.
8+ This guide covers advanced CI/CD patterns for building MCP server containers
9+ using ToolHive's [ ` thv build ` ] ( ../reference/cli/thv_build.md ) command. These
10+ patterns include multi-architecture builds, supply chain security, and efficient
11+ change detection.
12+
13+ These patterns are intended for anyone building MCP server containers regularly,
14+ such as maintainers of MCP servers or organizations deploying custom servers or
15+ repackaging existing ones.
1216
1317## Prerequisites
1418
@@ -19,9 +23,10 @@ Before implementing these advanced patterns, ensure you have:
1923- Container registry access for pushing images
2024- Understanding of Docker Buildx for multi-architecture builds
2125
22- ## Multi-architecture builds
26+ ## Multi-architecture MCP server builds
2327
24- Build containers for multiple architectures (amd64, arm64) using Docker Buildx:
28+ Build MCP server containers for multiple architectures (amd64, arm64) using
29+ Docker Buildx:
2530
2631``` yaml
2732name : Multi-arch Build
4247 uses : docker/setup-buildx-action@v3
4348
4449 - name : Install ToolHive
45- run : |
46- # Install ToolHive CLI (replace with your preferred installation method)
47- # See: https://github.com/stacklok/toolhive/releases
48- wget https://github.com/stacklok/toolhive/releases/latest/download/toolhive_linux_amd64.tar.gz
49- tar -xzf toolhive_linux_amd64.tar.gz
50- sudo install -m 0755 thv /usr/local/bin/
50+ uses : StacklokLabs/toolhive-actions/install@v0
51+ with :
52+ version : latest
5153
5254 - name : Generate Dockerfile
5355 run : |
9092 uses : docker/setup-buildx-action@v3
9193
9294 - name : Install ToolHive
93- run : |
94- # Install ToolHive CLI (replace with your preferred installation method)
95- # See: https://github.com/stacklok/toolhive/releases
96- wget https://github.com/stacklok/toolhive/releases/latest/download/toolhive_linux_amd64.tar.gz
97- tar -xzf toolhive_linux_amd64.tar.gz
98- sudo install -m 0755 thv /usr/local/bin/
95+ uses : StacklokLabs/toolhive-actions/install@v0
96+ with :
97+ version : latest
9998
10099 - name : Generate Dockerfile
101100 run : |
@@ -161,12 +160,9 @@ jobs:
161160 - uses : actions/checkout@v4
162161
163162 - name : Install ToolHive
164- run : |
165- # Install ToolHive CLI (replace with your preferred installation method)
166- # See: https://github.com/stacklok/toolhive/releases
167- wget https://github.com/stacklok/toolhive/releases/latest/download/toolhive_linux_amd64.tar.gz
168- tar -xzf toolhive_linux_amd64.tar.gz
169- sudo install -m 0755 thv /usr/local/bin/
163+ uses : StacklokLabs/toolhive-actions/install@v0
164+ with :
165+ version : latest
170166
171167 - name : Build containers
172168 run : |
@@ -199,12 +195,9 @@ jobs:
199195 - uses : actions/checkout@v4
200196
201197 - name : Install ToolHive
202- run : |
203- # Install ToolHive CLI (replace with your preferred installation method)
204- # See: https://github.com/stacklok/toolhive/releases
205- wget https://github.com/stacklok/toolhive/releases/latest/download/toolhive_linux_amd64.tar.gz
206- tar -xzf toolhive_linux_amd64.tar.gz
207- sudo install -m 0755 thv /usr/local/bin/
198+ uses : StacklokLabs/toolhive-actions/install@v0
199+ with :
200+ version : latest
208201
209202 - name : Build ${{ matrix.server.name }}
210203 run : |
@@ -233,12 +226,9 @@ jobs:
233226 - uses : actions/checkout@v4
234227
235228 - name : Install ToolHive
236- run : |
237- # Install ToolHive CLI (replace with your preferred installation method)
238- # See: https://github.com/stacklok/toolhive/releases
239- wget https://github.com/stacklok/toolhive/releases/latest/download/toolhive_linux_amd64.tar.gz
240- tar -xzf toolhive_linux_amd64.tar.gz
241- sudo install -m 0755 thv /usr/local/bin/
229+ uses : StacklokLabs/toolhive-actions/install@v0
230+ with :
231+ version : latest
242232
243233 - name : Build container
244234 run : |
@@ -284,10 +274,11 @@ build:
284274 services :
285275 - docker:dind
286276 before_script :
277+ # Install ToolHive CLI using curl and jq to get the latest version
287278 - |
288- # Install ToolHive CLI
289- wget https://github.com/stacklok/toolhive/releases/latest/ download/toolhive_linux_amd64 .tar.gz
290- tar -xzf toolhive_linux_amd64 .tar.gz
279+ VERSION=$(curl -s https://api.github.com/repos/stacklok/toolhive/releases/latest | jq -r .tag_name)
280+ wget " https://github.com/stacklok/toolhive/releases/download/${VERSION}/toolhive_${VERSION#v}_linux_amd64 .tar.gz"
281+ tar -xzf "toolhive_${VERSION#v}_linux_amd64 .tar.gz"
291282 install -m 0755 thv /usr/local/bin/
292283 - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
293284 script :
@@ -322,6 +313,6 @@ When implementing advanced CI/CD patterns:
322313# # Related information
323314
324315- [Build MCP server containers](./build-containers.mdx)
325- - [Run MCP servers in Kubernetes](../guides-k8s/run-mcp-k8s.md )
316+ - [Run MCP servers in Kubernetes](../guides-k8s/run-mcp-k8s.mdx )
326317- [`thv build` command reference](../reference/cli/thv_build.md)
327318- [Secrets management](./secrets-management.mdx)
0 commit comments