mirror of
https://github.com/Retropex/dockerfile-deps.git
synced 2025-05-21 11:52:28 +02:00
Add bitcoin core 0.22
This commit is contained in:
parent
a3cc837cd2
commit
b89bb9bd13
65
Bitcoin/0.22/docker-entrypoint.sh
Executable file
65
Bitcoin/0.22/docker-entrypoint.sh
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ "$1" == "bitcoin-cli" || "$1" == "bitcoin-tx" || "$1" == "bitcoind" || "$1" == "test_bitcoin" ]]; then
|
||||||
|
mkdir -p "$BITCOIN_DATA"
|
||||||
|
|
||||||
|
CONFIG_PREFIX=""
|
||||||
|
if [[ "${BITCOIN_NETWORK}" == "regtest" ]]; then
|
||||||
|
CONFIG_PREFIX=$'regtest=1\n[regtest]'
|
||||||
|
elif [[ "${BITCOIN_NETWORK}" == "testnet" ]]; then
|
||||||
|
CONFIG_PREFIX=$'testnet=1\n[test]'
|
||||||
|
elif [[ "${BITCOIN_NETWORK}" == "mainnet" ]]; then
|
||||||
|
CONFIG_PREFIX=$'mainnet=1\n[main]'
|
||||||
|
elif [[ "${BITCOIN_NETWORK}" == "signet" ]]; then
|
||||||
|
CONFIG_PREFIX=$'signet=1\n[signet]'
|
||||||
|
else
|
||||||
|
BITCOIN_NETWORK="mainnet"
|
||||||
|
CONFIG_PREFIX=$'mainnet=1\n[main]'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$BITCOIN_WALLETDIR" ]] && [[ "$BITCOIN_NETWORK" ]]; then
|
||||||
|
NL=$'\n'
|
||||||
|
WALLETDIR="$BITCOIN_WALLETDIR/${BITCOIN_NETWORK}"
|
||||||
|
WALLETFILE="${WALLETDIR}/wallet.dat"
|
||||||
|
mkdir -p "$WALLETDIR"
|
||||||
|
chown -R bitcoin:bitcoin "$WALLETDIR"
|
||||||
|
CONFIG_PREFIX="${CONFIG_PREFIX}${NL}walletdir=${WALLETDIR}${NL}"
|
||||||
|
if ! [[ -f "${WALLETFILE}" ]]; then
|
||||||
|
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
|
||||||
|
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-wallet=" create
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<-EOF > "$BITCOIN_DATA/bitcoin.conf"
|
||||||
|
${CONFIG_PREFIX}
|
||||||
|
printtoconsole=1
|
||||||
|
rpcallowip=::/0
|
||||||
|
${BITCOIN_EXTRA_ARGS}
|
||||||
|
EOF
|
||||||
|
chown bitcoin:bitcoin "$BITCOIN_DATA/bitcoin.conf"
|
||||||
|
|
||||||
|
if [[ "${BITCOIN_TORCONTROL}" ]]; then
|
||||||
|
# Because bitcoind only accept torcontrol= host as an ip only, we resolve it here and add to config
|
||||||
|
TOR_CONTROL_HOST=$(echo ${BITCOIN_TORCONTROL} | cut -d ':' -f 1)
|
||||||
|
TOR_CONTROL_PORT=$(echo ${BITCOIN_TORCONTROL} | cut -d ':' -f 2)
|
||||||
|
if [[ "$TOR_CONTROL_HOST" ]] && [[ "$TOR_CONTROL_PORT" ]]; then
|
||||||
|
TOR_IP=$(getent hosts $TOR_CONTROL_HOST | cut -d ' ' -f 1)
|
||||||
|
echo "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" >> "$BITCOIN_DATA/bitcoin.conf"
|
||||||
|
echo "Added "torcontrol=$TOR_IP:$TOR_CONTROL_PORT" to $BITCOIN_DATA/bitcoin.conf"
|
||||||
|
else
|
||||||
|
echo "Invalid BITCOIN_TORCONTROL"
|
||||||
|
fi
|
||||||
|
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 "$@"
|
||||||
|
else
|
||||||
|
exec "$@"
|
||||||
|
fi
|
40
Bitcoin/0.22/linuxamd64.Dockerfile
Normal file
40
Bitcoin/0.22/linuxamd64.Dockerfile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
FROM debian:buster-slim as builder
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
|
||||||
|
|
||||||
|
ENV BITCOIN_VERSION 0.22
|
||||||
|
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
|
||||||
|
ENV BITCOIN_SHA256 59ebd25dd82a51638b7a6bb914586201e67db67b919b2a1ff08925a7936d1b16
|
||||||
|
|
||||||
|
# install bitcoin binaries
|
||||||
|
RUN set -ex \
|
||||||
|
&& cd /tmp \
|
||||||
|
&& wget -qO bitcoin.tar.gz "$BITCOIN_URL" \
|
||||||
|
&& echo "$BITCOIN_SHA256 bitcoin.tar.gz" | sha256sum -c - \
|
||||||
|
&& mkdir bin \
|
||||||
|
&& tar -xzvf bitcoin.tar.gz -C /tmp/bin --strip-components=2 "bitcoin-$BITCOIN_VERSION/bin/bitcoin-cli" "bitcoin-$BITCOIN_VERSION/bin/bitcoind" "bitcoin-$BITCOIN_VERSION/bin/bitcoin-wallet" \
|
||||||
|
&& cd bin \
|
||||||
|
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64" \
|
||||||
|
&& echo "0b843df6d86e270c5b0f5cbd3c326a04e18f4b7f9b8457fa497b0454c4b138d7 gosu" | sha256sum -c -
|
||||||
|
|
||||||
|
FROM debian:buster-slim
|
||||||
|
COPY --from=builder "/tmp/bin" /usr/local/bin
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/gosu && groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin
|
||||||
|
|
||||||
|
# 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"]
|
||||||
|
|
||||||
|
EXPOSE 8332 8333 18332 18333 18443 18444
|
||||||
|
CMD ["bitcoind"]
|
45
Bitcoin/0.22/linuxarm32v7.Dockerfile
Normal file
45
Bitcoin/0.22/linuxarm32v7.Dockerfile
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Use manifest image which support all architecture
|
||||||
|
FROM debian:buster-slim as builder
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
|
||||||
|
RUN apt-get install -qq --no-install-recommends qemu-user-static binfmt-support
|
||||||
|
|
||||||
|
ENV BITCOIN_VERSION 0.22
|
||||||
|
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
|
||||||
|
ENV BITCOIN_SHA256 b8713c6c5f03f5258b54e9f436e2ed6d85449aa24c2c9972f91963d413e86311
|
||||||
|
|
||||||
|
# install bitcoin binaries
|
||||||
|
RUN set -ex \
|
||||||
|
&& cd /tmp \
|
||||||
|
&& wget -qO bitcoin.tar.gz "$BITCOIN_URL" \
|
||||||
|
&& echo "$BITCOIN_SHA256 bitcoin.tar.gz" | sha256sum -c - \
|
||||||
|
&& mkdir bin \
|
||||||
|
&& tar -xzvf bitcoin.tar.gz -C /tmp/bin --strip-components=2 "bitcoin-$BITCOIN_VERSION/bin/bitcoin-cli" "bitcoin-$BITCOIN_VERSION/bin/bitcoind" "bitcoin-$BITCOIN_VERSION/bin/bitcoin-wallet" \
|
||||||
|
&& cd bin \
|
||||||
|
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-armhf" \
|
||||||
|
&& echo "171b4a2decc920de0dd4f49278d3e14712da5fa48de57c556f99bcdabe03552e gosu" | sha256sum -c -
|
||||||
|
|
||||||
|
# Making sure the builder build an arm image despite being x64
|
||||||
|
FROM arm32v7/debian:buster-slim
|
||||||
|
|
||||||
|
COPY --from=builder "/tmp/bin" /usr/local/bin
|
||||||
|
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/gosu && groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin
|
||||||
|
|
||||||
|
# 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"]
|
||||||
|
|
||||||
|
EXPOSE 8332 8333 18332 18333 18443 18444
|
||||||
|
CMD ["bitcoind"]
|
45
Bitcoin/0.22/linuxarm64v8.Dockerfile
Normal file
45
Bitcoin/0.22/linuxarm64v8.Dockerfile
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Use manifest image which support all architecture
|
||||||
|
FROM debian:buster-slim as builder
|
||||||
|
|
||||||
|
RUN set -ex \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
|
||||||
|
RUN apt-get install -qq --no-install-recommends qemu-user-static binfmt-support
|
||||||
|
|
||||||
|
ENV BITCOIN_VERSION 0.22
|
||||||
|
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
|
||||||
|
ENV BITCOIN_SHA256 ac718fed08570a81b3587587872ad85a25173afa5f9fbbd0c03ba4d1714cfa3e
|
||||||
|
|
||||||
|
# install bitcoin binaries
|
||||||
|
RUN set -ex \
|
||||||
|
&& cd /tmp \
|
||||||
|
&& wget -qO bitcoin.tar.gz "$BITCOIN_URL" \
|
||||||
|
&& echo "$BITCOIN_SHA256 bitcoin.tar.gz" | sha256sum -c - \
|
||||||
|
&& mkdir bin \
|
||||||
|
&& tar -xzvf bitcoin.tar.gz -C /tmp/bin --strip-components=2 "bitcoin-$BITCOIN_VERSION/bin/bitcoin-cli" "bitcoin-$BITCOIN_VERSION/bin/bitcoind" "bitcoin-$BITCOIN_VERSION/bin/bitcoin-wallet" \
|
||||||
|
&& cd bin \
|
||||||
|
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-arm64" \
|
||||||
|
&& echo "5e279972a1c7adee65e3b5661788e8706594b458b7ce318fecbd392492cc4dbd gosu" | sha256sum -c -
|
||||||
|
|
||||||
|
# Making sure the builder build an arm image despite being x64
|
||||||
|
FROM arm64v8/debian:buster-slim
|
||||||
|
|
||||||
|
COPY --from=builder "/tmp/bin" /usr/local/bin
|
||||||
|
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/gosu && groupadd -r bitcoin && useradd -r -m -g bitcoin bitcoin
|
||||||
|
|
||||||
|
# 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"]
|
||||||
|
|
||||||
|
EXPOSE 8332 8333 18332 18333 18443 18444
|
||||||
|
CMD ["bitcoind"]
|
Loading…
Reference in New Issue
Block a user