-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·49 lines (42 loc) · 1.06 KB
/
docker-entrypoint.sh
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
#!/bin/bash
set -eo pipefail
# Handle shutdown gracefully
shutdown_gracefully() {
echo "Container is shutting down, ensuring bitcoind flushes the db."
bitcoin-cli stop
sleep 5
}
trap shutdown_gracefully SIGTERM SIGHUP SIGQUIT SIGINT
# Create bitcoin directory and copy config only if it doesn't exist
mkdir -p "${BITCOIN_DIR}"
if [ ! -f "${BITCOIN_DIR}/bitcoin.conf" ]; then
echo "Creating new bitcoin.conf..."
cat > "${BITCOIN_DIR}/bitcoin.conf" << EOF
server=1
txindex=1
daemon=1
signet=1
[signet]
signetchallenge=512102f7561d208dd9ae99bf497273e16f389bdbd6c4742ddb8e6b216e64fa2928ad8f51ae
addnode=45.79.52.207:38333
dnsseed=0
signetblocktime=30
# RPC Configuration
rpcuser=bitcoin
rpcpassword=bitcoin
rpcbind=0.0.0.0:38332
rpcallowip=0.0.0.0/0
# ZMQ Configuration
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
zmqpubhashblock=tcp://0.0.0.0:28334
EOF
else
echo "bitcoin.conf already exists, using existing config"
fi
# Start bitcoind
bitcoind -daemonwait
# Keep container running
while true; do
tail -f /dev/null & wait ${!}
done