-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdocker-entrypoint.sh.erb
executable file
·40 lines (33 loc) · 1.22 KB
/
docker-entrypoint.sh.erb
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
#!/bin/bash
set -e
core_pattern=$(cat /proc/sys/kernel/core_pattern)
pattern_start="$(echo $core_pattern | head -c 1)"
# In case core pattern doesn't start with pipe make sure that specified
# directory exists and has sufficient permissions to write core dump.
if [[ $pattern_start != "|" ]]; then
directory=`dirname "$core_pattern"`
mkdir -p "$directory"
chmod 777 "$directory"
fi
if [[ "$1" == "<%= binary_cli %>" || "$1" == "<%= binary_tx %>" || "$1" == "<%= binary %>" || "$1" == "<%= binary_test %>" ]]; then
mkdir -p "$BITCOIN_DATA"
if [[ ! -s "$BITCOIN_DATA/bitcoin.conf" ]]; then
cat <<-EOF > "$BITCOIN_DATA/bitcoin.conf"
printtoconsole=1
rpcallowip=::/0
rpcpassword=${BITCOIN_RPC_PASSWORD:-password}
rpcuser=${BITCOIN_RPC_USER:-bitcoin}
excessiveblocksize=1000000000
maxstackmemoryusageconsensus=100000000
EOF
chown bitcoin:bitcoin "$BITCOIN_DATA/bitcoin.conf"
fi
# ensure correct ownership and linking of data directory
# we do not update group ownership here, in case users want to mount
# a host directory and still retain access to it
chown -R bitcoin "$BITCOIN_DATA"
ln -sfn "$BITCOIN_DATA" /home/bitcoin/.bitcoin
chown -h bitcoin:bitcoin /home/bitcoin/.bitcoin
exec gosu bitcoin "$@"
fi
exec "$@"