Compare commits

..

5 Commits

Author SHA1 Message Date
nicolas.dorier
d5626fb071
b 2021-10-19 17:36:51 +09:00
nicolas.dorier
0d150513a0
b 2021-10-19 17:31:27 +09:00
nicolas.dorier
37bfeb84e8
b 2021-10-19 17:21:51 +09:00
nicolas.dorier
1ce280f20d
b 2021-10-19 16:39:17 +09:00
nicolas.dorier
43a631a65b
[JoinMarket] Use git rather than zip file 2021-10-19 14:40:34 +09:00
427 changed files with 105 additions and 19768 deletions

View File

@ -7,39 +7,17 @@
version: 2
jobs:
build:
docker:
- image: cimg/base:stable
machine:
enabled: true
steps:
- checkout
- setup_remote_docker:
version: 20.10.24
# publish jobs require $DOCKERHUB_USER, $DOCKERHUB_PASS defined
publish_buildx:
docker:
- image: cimg/base:stable
steps:
- checkout
- setup_remote_docker:
version: 20.10.24
- run:
command: |
source ".circleci/parse-tag.sh"
DOCKERHUB_DOCKEFILE="$DOCKERHUB_DOCKEFILE_BUILDX"
DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG"
if [ -f $DOCKERHUB_DOCKEFILE ]; then
source ".circleci/push-image-buildx.sh"
else
echo "Skipping linuxamd64 because $DOCKERHUB_DOCKEFILE_BUILDX is not found"
fi
publish_linuxamd64:
docker:
- image: cimg/base:stable
machine:
enabled: true
steps:
- checkout
- setup_remote_docker:
version: 20.10.24
- checkout
- run:
command: |
source ".circleci/parse-tag.sh"
@ -52,12 +30,10 @@ jobs:
fi
publish_linuxarm64v8:
docker:
- image: cimg/base:stable
machine:
enabled: true
steps:
- checkout
- setup_remote_docker:
version: 20.10.24
- checkout
- run:
command: |
source ".circleci/parse-tag.sh"
@ -66,7 +42,7 @@ jobs:
if [ -f $DOCKERHUB_DOCKEFILE ]; then
#
# Make sure the builder is copy the arm emulator
sudo docker $DOCKER_OPTIONS run --rm --privileged multiarch/qemu-user-static:register --reset
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
sudo apt update
sudo apt install -y qemu qemu-user-static qemu-user binfmt-support
sudo cp /usr/bin/qemu-aarch64-static "$(dirname "$DOCKERHUB_DOCKEFILE")/qemu-aarch64-static"
@ -77,12 +53,10 @@ jobs:
echo "Skipping linuxarm64v8 because $DOCKERHUB_DOCKEFILE is not found"
fi
publish_linuxarm32v7:
docker:
- image: cimg/base:stable
machine:
enabled: true
steps:
- checkout
- setup_remote_docker:
version: 20.10.24
- run:
command: |
source ".circleci/parse-tag.sh"
@ -91,7 +65,7 @@ jobs:
if [ -f $DOCKERHUB_DOCKEFILE ]; then
#
# Make sure the builder is copy the arm emulator
sudo docker $DOCKER_OPTIONS run --rm --privileged multiarch/qemu-user-static:register --reset
sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
if grep "#EnableQEMU" $DOCKERHUB_DOCKEFILE; then
sudo apt update
sudo apt install -y qemu qemu-user-static qemu-user binfmt-support
@ -104,17 +78,19 @@ jobs:
echo "Skipping linuxarm32v7 because $DOCKERHUB_DOCKEFILE is not found"
fi
publish_multiarch:
docker:
- image: cimg/base:stable
machine:
enabled: true
image: circleci/classic:201808-01
steps:
- checkout
- setup_remote_docker:
version: 20.10.24
- run:
command: |
# Turn on Experimental features
sudo mkdir $HOME/.docker
sudo sh -c 'echo "{ \"experimental\": \"enabled\" }" >> $HOME/.docker/config.json'
source ".circleci/parse-tag.sh"
#
sudo docker $DOCKER_OPTIONS login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
IMAGES=""
if [ -f $DOCKERHUB_DOCKEFILE_AMD64 ]; then
IMAGES="$IMAGES $DOCKERHUB_DESTINATION-amd64"
@ -130,15 +106,15 @@ jobs:
else
sudo docker manifest create --amend $DOCKERHUB_DESTINATION $IMAGES
if [ -f $DOCKERHUB_DOCKEFILE_AMD64 ]; then
sudo docker $DOCKER_OPTIONS manifest annotate $DOCKERHUB_DESTINATION $DOCKERHUB_DESTINATION-amd64 --os linux --arch amd64
sudo docker manifest annotate $DOCKERHUB_DESTINATION $DOCKERHUB_DESTINATION-amd64 --os linux --arch amd64
fi
if [ -f $DOCKERHUB_DOCKEFILE_ARM32 ]; then
sudo docker $DOCKER_OPTIONS manifest annotate $DOCKERHUB_DESTINATION $DOCKERHUB_DESTINATION-arm32v7 --os linux --arch arm --variant v7
sudo docker manifest annotate $DOCKERHUB_DESTINATION $DOCKERHUB_DESTINATION-arm32v7 --os linux --arch arm --variant v7
fi
if [ -f $DOCKERHUB_DOCKEFILE_ARM64 ]; then
sudo docker $DOCKER_OPTIONS manifest annotate $DOCKERHUB_DESTINATION $DOCKERHUB_DESTINATION-arm64v8 --os linux --arch arm64 --variant v8
sudo docker manifest annotate $DOCKERHUB_DESTINATION $DOCKERHUB_DESTINATION-arm64v8 --os linux --arch arm64 --variant v8
fi
sudo docker $DOCKER_OPTIONS manifest push $DOCKERHUB_DESTINATION -p
sudo docker manifest push $DOCKERHUB_DESTINATION -p
fi
workflows:
@ -151,37 +127,29 @@ workflows:
ignore: /.*/
# Example: BitcoinCore/0.17.0 or BitcoinCore/0.17.0-1 or Bitcoin/0.21.0-based-taproot0.1
tags:
only: /^[^/]+[/]{1}([^/]+)/
only: /^[^/]+[/][0-9]+(\.[0-9]+)*(-[a-z0-9\.-]+)?/
- publish_linuxarm32v7:
filters:
branches:
ignore: /.*/
tags:
# Example: BitcoinCore/0.17.0
only: /^[^/]+[/]{1}([^/]+)/
only: /^[^/]+[/][0-9]+(\.[0-9]+)*(-[a-z0-9\.-]+)?/
- publish_linuxarm64v8:
filters:
branches:
ignore: /.*/
tags:
# Example: BitcoinCore/0.17.0
only: /^[^/]+[/]{1}([^/]+)/
- publish_buildx:
filters:
branches:
ignore: /.*/
tags:
# Example: BitcoinCore/0.17.0
only: /^[^/]+[/]{1}([^/]+)/
only: /^[^/]+[/][0-9]+(\.[0-9]+)*(-[a-z0-9\.-]+)?/
- publish_multiarch:
requires:
- publish_linuxamd64
- publish_linuxarm32v7
- publish_linuxarm64v8
- publish_buildx
filters:
branches:
ignore: /.*/
tags:
# Example: BitcoinCore/0.17.0
only: /^[^/]+[/]{1}([^/]+)/
only: /^[^/]+[/][0-9]+(\.[0-9]+)*(-[a-z0-9\.-]+)?/

View File

@ -28,9 +28,6 @@ DOCKERHUB_DESTINATION="$DOCKERHUB_REPO:$LATEST_TAG"
DOCKERHUB_DOCKEFILE_ARM64="$NODE_NAME/$NODE_VERSION/linuxarm64v8.Dockerfile"
DOCKERHUB_DOCKEFILE_ARM32="$NODE_NAME/$NODE_VERSION/linuxarm32v7.Dockerfile"
DOCKERHUB_DOCKEFILE_AMD64="$NODE_NAME/$NODE_VERSION/linuxamd64.Dockerfile"
DOCKERHUB_DOCKEFILE_BUILDX="$NODE_NAME/$NODE_VERSION/Dockerfile"
DOCKER_OPTIONS="-H=$DOCKER_HOST"
echo "LATEST_TAG=$LATEST_TAG"
echo "NODE_VERSION=$NODE_VERSION"

View File

@ -1,10 +0,0 @@
#!/bin/bash
echo "Pushing $DOCKERHUB_DOCKEFILE to dockerhub repository $DOCKERHUB_DESTINATION"
sudo docker $DOCKER_OPTIONS login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker buildx create --use
DOCKER_BUILDX_OPTS="--platform linux/amd64,linux/arm64,linux/arm/v7 --push"
sudo docker buildx build $DOCKER_BUILDX_OPTS \
-f "$DOCKERHUB_DOCKEFILE" \
-t $DOCKERHUB_DESTINATION \
"$NODE_NAME/$NODE_VERSION"

View File

@ -1,6 +1,6 @@
#!/bin/bash
echo "Pushing $DOCKERHUB_DOCKEFILE to dockerhub repository $DOCKERHUB_DESTINATION"
sudo docker $DOCKER_OPTIONS login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker $DOCKER_OPTIONS build --pull -t $DOCKERHUB_DESTINATION -f "$DOCKERHUB_DOCKEFILE" "$NODE_NAME/$NODE_VERSION"
sudo docker $DOCKER_OPTIONS push $DOCKERHUB_DESTINATION
sudo docker login --username=$DOCKERHUB_USER --password=$DOCKERHUB_PASS
sudo docker build --pull -t $DOCKERHUB_DESTINATION -f "$DOCKERHUB_DOCKEFILE" "$NODE_NAME/$NODE_VERSION"
sudo docker push $DOCKERHUB_DESTINATION

View File

@ -1,65 +0,0 @@
#!/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}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,40 +0,0 @@
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 23.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 2cca490c1f2842884a3c5b0606f179f9f937177da4eadd628e3f7fd7e25d26d0
# 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"]

View File

@ -1,45 +0,0 @@
# 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 23.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 952c574366aff76f6d6ad1c9ee45a361d64fa04155e973e926dfe7e26f9703a3
# 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"]

View File

@ -1,45 +0,0 @@
# 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 23.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 06f4c78271a77752ba5990d60d81b1751507f77efda1e5981b4e92fd4d9969fb
# 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"]

View File

@ -1,80 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,43 +0,0 @@
FROM debian:bullseye-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 24.0.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 49df6e444515d457ea0b885d66f521f2a26ca92ccf73d5296082e633544253bf
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
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"]

View File

@ -1,48 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 24.0.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 37d7660f0277301744e96426bbb001d2206b8d4505385dfdeedf50c09aaaef60
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
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"]

View File

@ -1,48 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 24.0.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 0b48b9e69b30037b41a1e6b78fb7cbcc48c7ad627908c99686e81f3802454609
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
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"]

View File

@ -1,66 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,40 +0,0 @@
FROM debian:bullseye-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 24.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 fb86cf6af7a10bc5f3ae6cd6a5b0348854e1462102fe71e755d30b51b6e317d1
# 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:bullseye-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"]

View File

@ -1,45 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 24.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 806f822a0498bb4f93ba13d6370e544c2344a768cd45c5a24cab1e7e87930204
# 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:bullseye-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"]

View File

@ -1,45 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 24.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 904e103f08f776d03935118568411724f9e070e0e888e52c9e5692308fa47d49
# 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:bullseye-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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bullseye-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 24.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 c112af3d19cca7f5b5f942708ca4d522110d8e1dc1c0f8d3077f531c94e5f00f
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 24.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 96d8c7369972848833bddbeaa07351c2843429788151d86bde2ff6f7a756ea52
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 24.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 69ef67b290ce05120d8a5a5a5c0aa3e7d4878838286e6dc96935d15fc0d44b56
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bullseye-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 25.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 33930d432593e49d58a9bff4c30078823e9af5d98594d2935862788ce8a20aec
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 25.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 e537c8630b05e63242d979c3004f851fd73c2a10b5b4fdbb161788427c7b3c0f
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bullseye-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 25.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 3a7bdd959a0b426624f63f394f25e5b7769a5a2f96f8126dcc2ea53f3fa5212b
# 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:bullseye-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 25.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 a978c407b497a727f0444156e397b50491ce862d1f906fef9b521415b3611c8b
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 25.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 28b8811984e215d9dc42536394629029edc1d15ab896f007d54d1d42a343f9db
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM arm32v7/debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 25.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 69b49bd4eda484a8b8e0e806649e5b7ae9b93b3dbb9889af23696437359bc52c
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM arm64v8/debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 26.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 23e5ab226d9e01ffaadef5ffabe8868d0db23db952b90b0593652993680bb8ab
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 26.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 e02b8b02fffc74f603bd7030809fefd3d95808e059f1da5e3269d5d98f18809b
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM arm32v7/debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 26.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 9cf64f42c72d8a96892aa1e2ec9cbca6f3b7094148a8261127390bc6fb4d20c4
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM arm64v8/debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 27.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 c9840607d230d65f6938b81deaec0b98fe9cb14c3a41a5b13b2c05d044a48422
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 27.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 83bf6da65ebac189c7e14f1e68a758b32b8f83558b36b53a8cc8037c674ab045
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM arm32v7/debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 27.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 bb878df4f8ff8fb8acfb94207c50f959c462c39e652f507c2a2db20acc6a1eee
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM arm64v8/debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 28.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 07f77afd326639145b9ba9562912b2ad2ccec47b8a305bd075b4f4cb127b7ed7
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 28.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 6448274420ac632c528bbd4da7198692232cef7bd16d101febc5d05f7d4af1d2
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 28.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 6ddb6990690bd4c9a9f4319ed6f6e9c995c85ce5530ee9f120e80ce09e090c44
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 29.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 a681e4f6ce524c338a105f214613605bac6c33d58c31dc5135bbc02bc458bb6c
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 ea8ca24ab56d486a55289c43cb4256f9f0e66224899cc43482c9498a3f2614d1
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 7922ac99363dd28f79e57ef7098581fd48ebd1119b412b07e73b1fd19fd0443f
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 29.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 2dddeaa8c0626ec446b6f21b64c0f3565a1e7e67ff0b586d25043cbd686c9455
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 aec1838105c44a97e10bd7a47af52d83728c98272f9e32650b3fe83ed78f9dec
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.1
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 d6be913e1abc5effe57f50630b4bff2f89b38c092182c47f1fcde0ae12afc71c
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 29.2
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 1fd58d0ae94b8a9e21bbaeab7d53395a44976e82bd5492b0a894826c135f9009
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.2
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 3a19e89082db0f891751c1484adf41bcd8fd12ed57e40ed177765436bed72aa1
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.2
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 f88f72a3c5bf526581aae573be8c1f62133eaecfe3d34646c9ffca7b79dfdc7a
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,90 +0,0 @@
#!/bin/bash
set -e
is_sqlite()
{
local f=$1
# read first 16 bytes and compare to the SQLite header
printf 'SQLite format 3\0' | cmp -n 16 -s - "$f"
}
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=$'[main]'
elif [[ "${BITCOIN_NETWORK}" == "signet" ]]; then
CONFIG_PREFIX=$'signet=1\n[signet]'
else
BITCOIN_NETWORK="mainnet"
CONFIG_PREFIX=$'[main]'
fi
need_migrate=false
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}"
: "${CREATE_WALLET:=true}"
if [[ "${CREATE_WALLET}" != "false" ]]; then
if ! [[ -f "${WALLETFILE}" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-${BITCOIN_NETWORK}" "-datadir=${WALLETDIR}" "-wallet=" create
elif ! is_sqlite "${WALLETFILE}"; then
need_migrate=true
echo "Legacy wallet migration needed"
fi
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
rm -f /home/bitcoin/.bitcoin/settings.json
if [[ "${need_migrate}" == "true" ]]; then
echo "Migrating legacy bitcoin wallet..."
gosu bitcoin "$@" &
BITCOIN_PID=$!
gosu bitcoin bitcoin-cli -datadir="${BITCOIN_DATA}" -rpcwait migratewallet ""
gosu bitcoin bitcoin-cli -datadir="${BITCOIN_DATA}" -rpcwait stop
wait "${BITCOIN_PID}"
echo "Bitcoin legacy wallet migrated."
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 30.2
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 6aa7bb4feb699c4c6262dd23e4004191f6df7f373b5d5978b5bcdd4bb72f75d8
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 30.2
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 d510542842318ea34d87cb2c93d6a7fe091dcac2e8684460be2b3c44843fb502
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 30.2
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 73e76c14edc79808a0511c744d102ffbb494807ee90cbcba176568243254b532
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,145 +0,0 @@
#!/bin/bash
set -e
is_sqlite()
{
local f=$1
# read first 16 bytes and compare to the SQLite header
printf 'SQLite format 3\0' | cmp -n 16 -s - "$f"
}
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=$'[main]'
elif [[ "${BITCOIN_NETWORK}" == "signet" ]]; then
CONFIG_PREFIX=$'signet=1\n[signet]'
else
BITCOIN_NETWORK="mainnet"
CONFIG_PREFIX=$'[main]'
fi
need_migrate=false
if [[ "$BITCOIN_WALLETDIR" ]] && [[ "$BITCOIN_NETWORK" ]]; then
NL=$'\n'
WALLET_NAME="default"
NETWORK_WALLETDIR="${BITCOIN_WALLETDIR}/${BITCOIN_NETWORK}"
WALLETDIR="${NETWORK_WALLETDIR}/${WALLET_NAME}"
WALLETFILE="${WALLETDIR}/wallet.dat"
LEGACY_WALLETDIR="${NETWORK_WALLETDIR}"
LEGACY_WALLETFILE="${LEGACY_WALLETDIR}/wallet.dat"
mkdir -p "${NETWORK_WALLETDIR}"
chown -R bitcoin:bitcoin "${NETWORK_WALLETDIR}"
CONFIG_PREFIX="${CONFIG_PREFIX}${NL}walletdir=${NETWORK_WALLETDIR}${NL}"
: "${CREATE_WALLET:=true}"
if [[ "${CREATE_WALLET}" != "false" ]]; then
CONFIG_PREFIX="${CONFIG_PREFIX}${NL}wallet=${WALLET_NAME}${NL}"
if [[ -f "${LEGACY_WALLETFILE}" ]] && ! [[ -f "${WALLETFILE}" ]]; then
mkdir -p "${WALLETDIR}"
chown -R bitcoin:bitcoin "${WALLETDIR}"
mv "${LEGACY_WALLETFILE}" "${WALLETFILE}"
[[ -f "${LEGACY_WALLETDIR}/db.log" ]] && mv "${LEGACY_WALLETDIR}/db.log" "${WALLETDIR}/db.log"
[[ -f "${LEGACY_WALLETDIR}/database" ]] && mv "${LEGACY_WALLETDIR}/database" "${WALLETDIR}/database"
echo "Moved ${LEGACY_WALLETFILE} -> ${WALLETFILE}"
fi
if ! [[ -f "${WALLETFILE}" ]]; then
echo "The wallet does not exists, creating it at ${NETWORK_WALLETDIR}..."
case "${BITCOIN_NETWORK}" in
mainnet)
NETWORK_FLAG=""
;;
testnet)
NETWORK_FLAG="-testnet"
;;
signet)
NETWORK_FLAG="-signet"
;;
regtest)
NETWORK_FLAG="-regtest"
;;
*)
echo "Unknown BITCOIN_NETWORK: ${BITCOIN_NETWORK}" >&2
exit 1
;;
esac
gosu bitcoin bitcoin-wallet ${NETWORK_FLAG} "-datadir=${NETWORK_WALLETDIR}" "-wallet=${WALLET_NAME}" create
# This stupid utility is creating the file somewhere depending on the network flag...
case "${BITCOIN_NETWORK}" in
mainnet)
;;
testnet)
mv "${NETWORK_WALLETDIR}/testnet3/default" "${NETWORK_WALLETDIR}/default"
rm -rf "${NETWORK_WALLETDIR}/testnet3"
;;
signet)
mv "${NETWORK_WALLETDIR}/signet/default" "${NETWORK_WALLETDIR}/default"
rm -rf "${NETWORK_WALLETDIR}/signet"
;;
regtest)
mv "${NETWORK_WALLETDIR}/regtest/default" "${NETWORK_WALLETDIR}/default"
rm -rf "${NETWORK_WALLETDIR}/regtest"
;;
*)
echo "Unknown BITCOIN_NETWORK: ${BITCOIN_NETWORK}" >&2
exit 1
;;
esac
elif ! is_sqlite "${WALLETFILE}"; then
need_migrate=true
echo "Legacy wallet migration needed"
fi
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
rm -f /home/bitcoin/.bitcoin/settings.json
if [[ "${need_migrate}" == "true" ]]; then
echo "Migrating legacy bitcoin wallet..."
gosu bitcoin "$@" &
BITCOIN_PID=$!
gosu bitcoin bitcoin-cli -datadir="${BITCOIN_DATA}" -rpcwait migratewallet "${WALLET_NAME}"
gosu bitcoin bitcoin-cli -datadir="${BITCOIN_DATA}" -rpcwait stop
wait "${BITCOIN_PID}"
echo "Bitcoin legacy wallet migrated."
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 31.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 d3e4c58a35b1d0a97a457462c94f55501ad167c660c245cb1ffa565641c65074
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 31.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 8c19d007bfc73502625095ea4073af3a98ceb722d500556ab173bac5bcadd0d6
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 31.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 4de1d568dedd48604f75132421bc0abeca432639589b49a3909c81db3a813112
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,65 +0,0 @@
#!/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

View File

@ -1,40 +0,0 @@
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.21.1.knots20210629
ENV BITCOIN_URL https://bitcoinknots.org/files/0.21.x/0.21.1.knots20210629/bitcoin-0.21.1.knots20210629-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 e47c6e3d5f24721575d8289e1293aaf872be0db1f2e4934aa59b50fd9ca176c4
# 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"]

View File

@ -1,45 +0,0 @@
# 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.21.1.knots20210629
ENV BITCOIN_URL https://bitcoinknots.org/files/0.21.x/0.21.1.knots20210629/bitcoin-0.21.1.knots20210629-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 159250d0da388501ecb0817524f36f03489e87df3dee71096a338d2afb593a6a
# 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"]

View File

@ -1,45 +0,0 @@
# 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.21.1.knots20210629
ENV BITCOIN_URL https://bitcoinknots.org/files/0.21.x/0.21.1.knots20210629/bitcoin-0.21.1.knots20210629-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 c72d4a726ecda2993ce728e0a829e1432cbf53b9d4853a253813c1894178f019
# 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"]

View File

@ -1,65 +0,0 @@
#!/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

View File

@ -1,40 +0,0 @@
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 21.2.knots20210629
ENV BITCOIN_URL https://bitcoinknots.org/files/21.x/21.2.knots20210629/bitcoin-21.2.knots20210629-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 14aaefd38fd863be8f23435cdd4f0c20f42516c94a6d51a9ddf805121daff3ab
# 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"]

View File

@ -1,45 +0,0 @@
# 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 21.2.knots20210629
ENV BITCOIN_URL https://bitcoinknots.org/files/21.x/21.2.knots20210629/bitcoin-21.2.knots20210629-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 0a1ff89f825d2822b8c69cb308633dc822fc373635a87cd8cceb29a68c40dac8
# 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"]

View File

@ -1,45 +0,0 @@
# 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 21.2.knots20210629
ENV BITCOIN_URL https://bitcoinknots.org/files/21.x/21.2.knots20210629/bitcoin-21.2.knots20210629-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 f33fdd9c67741be257d22c889e5ba05b093db9ad8a7e5c1c10c5c769599979d4
# 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"]

View File

@ -1,65 +0,0 @@
#!/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}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,40 +0,0 @@
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 23.0.knots20220529
ENV BITCOIN_URL https://bitcoinknots.org/files/23.x/23.0.knots20220529/bitcoin-23.0.knots20220529-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 d3350529a741d66312fc0f1b509bb91e3845e29830572aca23c865c96d5bdec9
# 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"]

View File

@ -1,45 +0,0 @@
# 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 23.0.knots20220529
ENV BITCOIN_URL https://bitcoinknots.org/files/23.x/23.0.knots20220529/bitcoin-23.0.knots20220529-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 9089b525aa0edfffde7aeb0c14b8a76e681bbe9cd840a4e70bfeec5c06589cca
# 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"]

View File

@ -1,45 +0,0 @@
# 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 23.0.knots20220529
ENV BITCOIN_URL https://bitcoinknots.org/files/23.x/23.0.knots20220529/bitcoin-23.0.knots20220529-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 83d3c195a1b93b94830c2b33b6f7ec81b5f947b98cc5097eeee76a6a7e3e3652
# 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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 28.1.knots20250305
ENV BITCOIN_URL https://bitcoinknots.org/files/28.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 dd80fa2c5076299e79cb1df03f1813ef0364e9b8b8288d0746f1d21983ceac72
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 28.1.knots20250305
ENV BITCOIN_URL https://bitcoinknots.org/files/28.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 22b2aaf02e374779a47e8c7fcff5b811a898878093e5707580b23ec668042638
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 28.1.knots20250305
ENV BITCOIN_URL https://bitcoinknots.org/files/28.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 87b5f3c96d23f043eb6f8faac63dc37eee5ecc1573b3edea9a4aa70756e42761
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 29.2.knots20251110
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 eb018a2274ab6cdcba3647c20a59731760545a2e85f0f863d45435dbcf4e7348
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.2.knots20251110
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 4bcd6ecc6091e6845e7e44350da0f8f6484eb2a878a8c1083550871b3a18f84b
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.2.knots20251110
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 6a8dad8b9f6d3d967f39c926808e027ebd0350342d3bdf7848edfb86b8f65a66
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 29.3.knots20260210
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 7611d9edbb21c4014999f4b2c3111e9634c86036424244a01e66edf919da3ef7
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.3.knots20260210
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 5cf9a3cf45042ad1718b86722c9165da278e0db1a515213c2f98cf955ab71837
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.3.knots20260210
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 cc495cd3c0b52769d70d9aad1116e2733ece4d100542060d3b9835112773e552
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,81 +0,0 @@
#!/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}"
: "${CREATE_WALLET:=true}"
if ! [[ -f "${WALLETFILE}" ]] && [[ "${CREATE_WALLET}" != "false" ]]; then
echo "The wallet does not exists, creating it at ${WALLETDIR}..."
gosu bitcoin bitcoin-wallet "-datadir=${WALLETDIR}" "-legacy" "-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
rm -f /home/bitcoin/.bitcoin/settings.json
# peers_dat is routinely corrupted, preventing bitcoind to start, see https://github.com/bitcoin/bitcoin/issues/26599
# This should be fixed in 24.1, but doesn't hurt to keep it
peers_dat="/home/bitcoin/.bitcoin/peers.dat"
peers_dat_corrupted="/home/bitcoin/.bitcoin/peers_corrupted.dat"
if [[ -f "${peers_dat}" ]]; then
actual_hash=$(head -c -32 "${peers_dat}" | sha256sum | cut -c1-64 | xxd -r -p | sha256sum | cut -c1-64)
expected_hash=$(tail -c 32 "${peers_dat}" | xxd -ps -c 32)
if [[ "${actual_hash}" != "${expected_hash}" ]]; then
echo "${peers_dat} is corrupted, moving it to ${peers_dat_corrupted}"
rm -f "${peers_dat_corrupted}"
mv "${peers_dat}" "${peers_dat_corrupted}"
fi
fi
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,46 +0,0 @@
FROM debian:bookworm-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget
ENV BITCOIN_VERSION 29.3.knots20260508
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 70bd12fb56a2fe3908e0f44f7f142f77a55aabc8427bf00b61cfa4deedcf0899
# 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.16/gosu-amd64" \
&& echo "3a4e1fc7430f9e7dd7b0cbbe0bfde26bf4a250702e84cf48a1eb2b631c64cf13 gosu" | sha256sum -c -
FROM debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.3.knots20260508
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-arm-linux-gnueabihf.tar.gz
ENV BITCOIN_SHA256 158c93aaef9d0ab990c2c500d59f1ab47f74c691e211cdf7a4b96eb84e70fdfc
# 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.16/gosu-armhf" \
&& echo "1b670d5426e1ddbb14a14280afb6850a48c219189d4cfe7e6eb2cc08a4fc7785 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,51 +0,0 @@
# Use manifest image which support all architecture
FROM debian:bookworm-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 29.3.knots20260508
ENV BITCOIN_URL https://bitcoinknots.org/files/29.x/${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-aarch64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 c80ed10834ed96f532bd673d6f691b960ddb00f6889d1fed9a3dcbf14284e01c
# 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.16/gosu-arm64" \
&& echo "23fa49907d5246d2e257de3bf883f57fba47fe1f559f7e732ff16c0f23d2b6a6 gosu" | sha256sum -c -
# Making sure the builder build an arm image despite being x64
FROM --platform=arm64 debian:bookworm-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder /usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
ARG BITCOIN_USER_ID=999
ARG BITCOIN_GROUP_ID=999
RUN apt-get update && \
apt-get install -qq --no-install-recommends xxd && \
rm -rf /var/lib/apt/lists/*
RUN chmod +x /usr/local/bin/gosu && groupadd -r -g $BITCOIN_GROUP_ID bitcoin && useradd -r -m -u $BITCOIN_USER_ID -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"]

View File

@ -1,34 +0,0 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS=linux
ARG TARGET_GOARCH=amd64
ARG TARGET_PLATFORM=amd64
ARG CLOUDFLARED_VERSION=2022.6.3
FROM golang:1.17.1 as builder
ARG CLOUDFLARED_VERSION
ARG TARGET_GOARCH
ARG TARGET_GOOS
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_OS=${TARGET_GOOS} \
TARGET_ARCH=${TARGET_GOARCH}
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN make cloudflared
# use a distroless base image with glibc
FROM --platform=${TARGET_PLATFORM} gcr.io/distroless/base-debian10:nonroot
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,34 +0,0 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS=linux
ARG TARGET_GOARCH=arm
ARG TARGET_PLATFORM=arm
ARG CLOUDFLARED_VERSION=2022.6.3
FROM golang:1.17.1 as builder
ARG CLOUDFLARED_VERSION
ARG TARGET_GOARCH
ARG TARGET_GOOS
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_OS=${TARGET_GOOS} \
TARGET_ARCH=${TARGET_GOARCH}
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN make cloudflared
# use a distroless base image with glibc
FROM --platform=${TARGET_PLATFORM} gcr.io/distroless/base-debian10:nonroot
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,34 +0,0 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS=linux
ARG TARGET_GOARCH=arm64
ARG TARGET_PLATFORM=arm64
ARG CLOUDFLARED_VERSION=2022.6.3
FROM golang:1.17.1 as builder
ARG CLOUDFLARED_VERSION
ARG TARGET_GOARCH
ARG TARGET_GOOS
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_OS=${TARGET_GOOS} \
TARGET_ARCH=${TARGET_GOARCH}
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN make cloudflared
# use a distroless base image with glibc
FROM --platform=${TARGET_PLATFORM} gcr.io/distroless/base-debian10:nonroot
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,26 +0,0 @@
FROM golang:1.20.6 as builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
CLOUDFLARED_VERSION=2023.10.0
WORKDIR /go/src/github.com/cloudflare/cloudflared/
# copy our sources into the builder image
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN GOOS=linux GOARCH=amd64 make cloudflared
# use a distroless base image with glibc
FROM --platform=amd64 gcr.io/distroless/base-debian11:nonroot
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,26 +0,0 @@
FROM golang:1.20.6 as builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
CLOUDFLARED_VERSION=2023.10.0
WORKDIR /go/src/github.com/cloudflare/cloudflared/
# copy our sources into the builder image
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN GOOS=linux GOARCH=arm make cloudflared
# use a distroless base image with glibc
FROM --platform=arm gcr.io/distroless/base-debian11:nonroot
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,26 +0,0 @@
FROM golang:1.20.6 as builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
CLOUDFLARED_VERSION=2023.10.0
WORKDIR /go/src/github.com/cloudflare/cloudflared/
# copy our sources into the builder image
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN GOOS=linux GOARCH=arm64 make cloudflared
# use a distroless base image with glibc
FROM --platform=arm64 gcr.io/distroless/base-debian11:nonroot
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,34 +0,0 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS=linux
ARG TARGET_GOARCH=amd64
ARG TARGET_PLATFORM=amd64
ARG CLOUDFLARED_VERSION=2023.7.3
FROM golang:1.19 as builder
ARG CLOUDFLARED_VERSION
ARG TARGET_GOARCH
ARG TARGET_GOOS
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_OS=${TARGET_GOOS} \
TARGET_ARCH=${TARGET_GOARCH}
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN make cloudflared
# use a distroless base image with glibc
FROM --platform=${TARGET_PLATFORM} gcr.io/distroless/base-debian11:nonroot
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,34 +0,0 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS=linux
ARG TARGET_GOARCH=arm
ARG TARGET_PLATFORM=arm
ARG CLOUDFLARED_VERSION=2023.7.3
FROM golang:1.19 as builder
ARG CLOUDFLARED_VERSION
ARG TARGET_GOARCH
ARG TARGET_GOOS
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_OS=${TARGET_GOOS} \
TARGET_ARCH=${TARGET_GOARCH}
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN make cloudflared
# use a distroless base image with glibc
FROM --platform=${TARGET_PLATFORM} gcr.io/distroless/base-debian11:nonroot
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,34 +0,0 @@
# use a builder image for building cloudflare
ARG TARGET_GOOS=linux
ARG TARGET_GOARCH=arm64
ARG TARGET_PLATFORM=arm64
ARG CLOUDFLARED_VERSION=2023.7.3
FROM golang:1.19 as builder
ARG CLOUDFLARED_VERSION
ARG TARGET_GOARCH
ARG TARGET_GOOS
ENV GO111MODULE=on \
CGO_ENABLED=0 \
TARGET_OS=${TARGET_GOOS} \
TARGET_ARCH=${TARGET_GOARCH}
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
WORKDIR /go/src/github.com/cloudflare/cloudflared/
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN make cloudflared
# use a distroless base image with glibc
FROM --platform=${TARGET_PLATFORM} gcr.io/distroless/base-debian11:nonroot
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,28 +0,0 @@
FROM --platform=$BUILDPLATFORM golang:1.23.0 AS builder
ARG TARGETARCH
ENV GO111MODULE=on \
CGO_ENABLED=0 \
CLOUDFLARED_VERSION=2024.8.2
WORKDIR /go/src/github.com/cloudflare/cloudflared/
# copy our sources into the builder image
RUN git clone --branch ${CLOUDFLARED_VERSION} --single-branch --depth 1 https://github.com/cloudflare/cloudflared.git .
# compile cloudflared
RUN GOOS=linux GOARCH=${TARGETARCH} make cloudflared
# use a distroless base image with glibc
FROM gcr.io/distroless/base-debian11:nonroot
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
# copy our compiled binary
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
# run as non-privileged user
USER nonroot
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -1,36 +0,0 @@
#!/bin/bash
set -e
if [[ "$1" == "dash-cli" || "$1" == "dash-tx" || "$1" == "dashd" || "$1" == "test_dash" ]]; then
mkdir -p "$BITCOIN_DATA"
CONFIG_PREFIX=""
if [[ "${BITCOIN_NETWORK}" == "regtest" ]]; then
CONFIG_PREFIX=$'regtest=1\n[regtest]'
fi
if [[ "${BITCOIN_NETWORK}" == "testnet" ]]; then
CONFIG_PREFIX=$'testnet=1\n[test]'
fi
if [[ "${BITCOIN_NETWORK}" == "mainnet" ]]; then
CONFIG_PREFIX=$'mainnet=1\n[main]'
fi
cat <<-EOF > "$BITCOIN_DATA/dash.conf"
${CONFIG_PREFIX}
printtoconsole=1
rpcallowip=::/0
${BITCOIN_EXTRA_ARGS}
EOF
chown bitcoin:bitcoin "$BITCOIN_DATA/dash.conf"
# 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/.dashcore
chown -h bitcoin:bitcoin /home/bitcoin/.dashcore
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -1,45 +0,0 @@
FROM debian:stretch-slim as builder
RUN set -ex \
&& apt-get update \
&& apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu gpg wget
ENV DASH_VERSION 18.0.1
ENV DASH_URL https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/dashcore-${DASH_VERSION}-x86_64-linux-gnu.tar.gz
ENV DASH_SHA256 c1fea7a83bbef34a358112f2a980ca4eb213aaea2f82486c6460100b2f22e317
ENV DASH_ASC_URL https://github.com/dashpay/dash/releases/download/v${DASH_VERSION}/SHA256SUMS.asc
ENV DASH_PGP_KEY 52527BEDABE87984
# install dash binaries
RUN set -ex \
&& cd /tmp \
&& wget -qO dash.tar.gz "$DASH_URL" \
&& echo "$DASH_SHA256 dash.tar.gz" | sha256sum -c - \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys "$DASH_PGP_KEY" \
&& wget -qO dash.asc "$DASH_ASC_URL" \
&& gpg --verify dash.asc \
&& mkdir bin \
&& tar -xzvf dash.tar.gz -C /tmp/bin --strip-components=2 "dashcore-$DASH_VERSION/bin/dash-cli" "dashcore-$DASH_VERSION/bin/dashd" \
&& cd bin \
&& wget -qO gosu "https://github.com/tianon/gosu/releases/download/1.11/gosu-amd64" \
&& echo "0b843df6d86e270c5b0f5cbd3c326a04e18f4b7f9b8457fa497b0454c4b138d7 gosu" | sha256sum -c -
FROM debian:stretch-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/.dashcore \
&& chown -h bitcoin:bitcoin /home/bitcoin/.dashcore
VOLUME /data
COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
EXPOSE 9998 9999 19998 19999
CMD ["dashd"]

Some files were not shown because too many files have changed in this diff Show More