Skip to content

Commit e567024

Browse files
committed
feat: option to start the self-contained image in mocknet mode
1 parent ee82fbc commit e567024

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

follower.Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ RUN node -e 'console.log("Node.js runs")'
5656
COPY --from=stacks-node-build /stacks-node stacks-node/
5757
ENV PATH="$PATH:$HOME/stacks-node"
5858

59+
#### Copy stacks-node mocknet config
60+
COPY ./stacks-blockchain/Stacks-mocknet.toml ./
61+
5962
### Setup stacks-blockchain-api
6063
COPY --from=build /app stacks-blockchain-api
6164
RUN sudo chown -Rh stacky:stacky stacks-blockchain-api
@@ -100,12 +103,20 @@ ENV STACKS_CORE_RPC_PORT=20443
100103

101104
### Startup script & coordinator
102105
RUN printf '#!/bin/bash\n\
106+
trap "exit" INT TERM\n\
107+
trap "kill 0" EXIT\n\
108+
echo Your container args are: "$@"\n\
103109
tail --retry -F stacks-api.log stacks-node.log 2>&1 &\n\
104110
while true\n\
105111
do\n\
106112
pg_start\n\
107113
stacks_api &> stacks-api.log &\n\
108114
stacks_api_pid=$!\n\
115+
if [ $1 = "mocknet" ]; then\n\
116+
stacks-node start --config=/home/stacky/Stacks-mocknet.toml &> stacks-node.log &\n\
117+
else\n\
118+
stacks-node argon &> stacks-node.log &\n\
119+
fi\n\
109120
stacks-node argon &> stacks-node.log &\n\
110121
stacks_node_pid=$!\n\
111122
wait $stacks_node_pid\n\
@@ -117,4 +128,6 @@ do\n\
117128
done\n\
118129
' >> run.sh && chmod +x run.sh
119130

131+
ENTRYPOINT ["/home/stacky/run.sh"]
132+
120133
CMD ["/home/stacky/run.sh"]

readme.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@
66

77
## Quick start
88

9-
A self-contained Docker image is provided which will start a Stacks 2.0 blockchain and API testnet.
9+
A self-contained Docker image is provided which starts a Stacks 2.0 blockchain and API instance connected to the testnet.
1010

1111
Ensure Docker is installed, then run the command:
1212

1313
```
1414
docker run -p 3999:3999 blockstack/stacks-blockchain-api-standalone
1515
```
1616

17+
Similarity, a "mocknet" instance can be started. This runs a local node, isolated from the testnet/mainnet:
18+
19+
```
20+
docker run -p 3999:3999 blockstack/stacks-blockchain-api-standalone mocknet
21+
```
22+
23+
1724
Once the blockchain has synced with network, the API will be available at:
1825
[http://localhost:3999](http://localhost:3999)
1926

0 commit comments

Comments
 (0)