forked from uphold/docker-bitcoin-abc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42c86c2
commit 5c80cb7
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin | ||
|
||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu gpg wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV BITCOIN_VERSION 27.0.0 | ||
ENV BITCOIN_URL "https://github.com/bitcoin-cash-node/bitcoin-cash-node/releases/download/v$BITCOIN_VERSION/bitcoin-cash-node-$BITCOIN_VERSION-x86_64-linux-gnu.tar.gz" | ||
ENV BITCOIN_SHA256 65307b1b13142defb5d4239a84c53b9f5ce7b7baca6ed8f899782ec7a9be4a72 | ||
|
||
# install bitcoin binaries | ||
RUN set -ex \ | ||
&& cd /tmp \ | ||
&& wget -qO bitcoin.tar.gz "$BITCOIN_URL" \ | ||
&& echo "$BITCOIN_SHA256 bitcoin.tar.gz" | sha256sum -c - \ | ||
&& tar -xzvf bitcoin.tar.gz -C /usr/local --strip-components=1 --exclude=*-qt \ | ||
&& rm -rf /tmp/* | ||
|
||
# create data directory | ||
ENV BITCOIN_DATA /data | ||
RUN mkdir "$BITCOIN_DATA" \ | ||
&& chown -R bitcoin:bitcoin "$BITCOIN_DATA" \ | ||
&& ln -sfn "$BITCOIN_DATA" /home/bitcoin/.bitcoin \ | ||
&& chown -h bitcoin:bitcoin /home/bitcoin/.bitcoin | ||
VOLUME /data | ||
|
||
COPY docker-entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh", "bitcoind"] | ||
|
||
EXPOSE 8332 8333 18332 18333 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
if [[ "$1" == "bitcoin-cli" || "$1" == "bitcoin-tx" || "$1" == "bitcoind" || "$1" == "test_bitcoin" ]]; 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} | ||
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 "$@" |