Skip to content

Commit 041a342

Browse files
committed
docker/single-node: adding --use-prebuilt flag
1 parent 8dbd433 commit 041a342

File tree

3 files changed

+47
-16
lines changed

3 files changed

+47
-16
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ This will start a single node with chain ID of `20143` and RPC at `localhost:808
7878
> single-node$ nets/run.sh --cached-build [...]/monad-bft/docker/single-node/logs/20250929_082118-2d71738c8dfba6d2
7979
> ```
8080
81+
#### Using Pre-built Images
82+
83+
To use existing images instead of building from source, edit `docker/single-node/nets/compose.prebuilt.yaml` to reference your images. Then run with the `--use-prebuilt` flag:
84+
85+
```bash
86+
nets/run.sh --use-prebuilt
87+
```
88+
8189
To test the RPC connection, try the following query:
8290

8391
```bash
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
build_triedb:
3+
image: categoryxyz/monad-execution:latest
4+
build_genesis:
5+
image: categoryxyz/monad-execution:latest
6+
monad_execution:
7+
image: categoryxyz/monad-execution:latest
8+
monad_node:
9+
image: categoryxyz/monad-bft:latest
10+
monad_rpc:
11+
image: categoryxyz/monad-rpc:latest

docker/single-node/nets/run.sh

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ set -ex
44

55
# --- Default variables ---
66
CACHED_VOL_ROOT=""
7+
USE_PREBUILT=false
78

89
# --- Function Definitions ---
910
usage() {
10-
echo "Usage: $0 [--cached-build /path/to/vol_root]"
11+
echo "Usage: $0 [--cached-build /path/to/vol_root] [--use-prebuilt]"
1112
echo " --cached-build: Skips all build steps and runs docker-compose from an existing volume root."
13+
echo " --use-prebuilt: Uses pre-built images (via compose.override.yaml) instead of building from source."
1214
exit 1
1315
}
1416

@@ -23,6 +25,9 @@ while [[ "$#" -gt 0 ]]; do
2325
CACHED_VOL_ROOT="$2"
2426
shift
2527
;;
28+
--use-prebuilt)
29+
USE_PREBUILT=true
30+
;;
2631
*)
2732
echo "Unknown parameter passed: $1"
2833
usage
@@ -83,22 +88,29 @@ if [ -z "$CACHED_VOL_ROOT" ]; then
8388
mkdir -p "$vol_root/node/triedb"
8489
truncate -s 4GB "$vol_root/node/triedb/test.db"
8590

86-
# Build monad execution (needs buildkit so unable to build in docker compose)
87-
set +e
88-
docker buildx inspect insecure &>/dev/null
89-
insecure_builder_no_exist=$?
90-
set -e
91-
if [ $insecure_builder_no_exist -ne 0 ]; then
92-
docker buildx create --buildkitd-flags '--allow-insecure-entitlement security.insecure' --name insecure
93-
fi
94-
docker build --builder insecure --allow security.insecure \
95-
-f "$MONAD_EXECUTION_ROOT/docker/release.Dockerfile" \
96-
--load -t monad-execution-builder:latest "$MONAD_EXECUTION_ROOT" \
97-
--build-arg GIT_COMMIT_HASH=$(git -C "$MONAD_EXECUTION_ROOT" rev-parse HEAD)
98-
9991
cd "$vol_root"
100-
# Run one-off build services and start node services, forcing a build of all images
101-
docker compose up build_triedb build_genesis monad_execution monad_node monad_rpc --build
92+
93+
if [ "$USE_PREBUILT" = true ]; then
94+
# Skip building, use pre-built images
95+
echo "Using pre-built images..."
96+
docker compose -f compose.yaml -f compose.prebuilt.yaml up build_triedb build_genesis monad_execution monad_node monad_rpc
97+
else
98+
# Build monad execution (needs buildkit so unable to build in docker compose)
99+
set +e
100+
docker buildx inspect insecure &>/dev/null
101+
insecure_builder_no_exist=$?
102+
set -e
103+
if [ $insecure_builder_no_exist -ne 0 ]; then
104+
docker buildx create --buildkitd-flags '--allow-insecure-entitlement security.insecure' --name insecure
105+
fi
106+
docker build --builder insecure --allow security.insecure \
107+
-f "$MONAD_EXECUTION_ROOT/docker/release.Dockerfile" \
108+
--load -t monad-execution-builder:latest "$MONAD_EXECUTION_ROOT" \
109+
--build-arg GIT_COMMIT_HASH=$(git -C "$MONAD_EXECUTION_ROOT" rev-parse HEAD)
110+
111+
# Run one-off build services and start node services, forcing a build of all images
112+
docker compose up build_triedb build_genesis monad_execution monad_node monad_rpc --build
113+
fi
102114

103115
else
104116
# === CACHED RUN ===

0 commit comments

Comments
 (0)