Commit Bitcoin Core 0.17.0

This commit is contained in:
nicolas.dorier 2018-11-24 22:35:58 +09:00
parent 0b9222265a
commit cb52477415
3 changed files with 93 additions and 0 deletions

18
.gitattributes vendored Normal file
View File

@ -0,0 +1,18 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text
# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf
# Declare files that will always have CRLF line endings on checkout.
*.sh text eol=lf
*.Dockerfile text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

View File

@ -0,0 +1,36 @@
#!/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]'
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/bitcoin.conf"
${CONFIG_PREFIX}
printtoconsole=1
rpcallowip=::/0
${BITCOIN_EXTRA_ARGS}
EOF
chown bitcoin:bitcoin "$BITCOIN_DATA/bitcoin.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/.bitcoin
chown -h bitcoin:bitcoin /home/bitcoin/.bitcoin
exec gosu bitcoin "$@"
else
exec "$@"
fi

View File

@ -0,0 +1,39 @@
FROM debian:stretch-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.17.0
ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-0.17.0/bitcoin-0.17.0-x86_64-linux-gnu.tar.gz
ENV BITCOIN_SHA256 9d6b472dc2aceedb1a974b93a3003a81b7e0265963bd2aa0acdcb17598215a4f
# 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"
FROM debian:stretch-slim
COPY --from=builder "/tmp/bin" /usr/local/bin
RUN apt-get update && apt-get install -qq --no-install-recommends gosu && rm -rf /var/lib/apt/lists/*
RUN 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"]