Update dockerfile
This commit is contained in:
parent
dbc4e523ab
commit
3f056ce757
76
Dockerfile
76
Dockerfile
@ -1,27 +1,65 @@
|
|||||||
# Use a base image with the necessary runtime dependencies
|
FROM debian:buster-slim as builder
|
||||||
FROM ubuntu
|
|
||||||
|
|
||||||
# Install runtime dependencies
|
ARG BITCOIN_VERSION=${BITCOIN_VERSION:-26.0}
|
||||||
RUN apt-get update && apt-get install -y jq
|
|
||||||
|
|
||||||
# Copy and prepare script for signet configurations
|
ARG TARGETPLATFORM
|
||||||
COPY generate_signet.sh /usr/local/bin/generate_signet.sh
|
|
||||||
RUN chmod +x /usr/local/bin/generate_signet.sh
|
|
||||||
|
|
||||||
# Copy Bitcoin.conf file
|
RUN apt-get update && \
|
||||||
COPY bitcoin.conf /root/.bitcoin/bitcoin.conf
|
apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget libc6 procps python3
|
||||||
|
WORKDIR /tmp
|
||||||
|
|
||||||
# Copy the logtail.sh script
|
# Install Bitcoin binaries based on platform
|
||||||
COPY logtail.sh /usr/local/bin/logtail.sh
|
RUN case $TARGETPLATFORM in \
|
||||||
RUN chmod +x /usr/local/bin/logtail.sh
|
linux/amd64) export TRIPLET="x86_64-linux-gnu";; \
|
||||||
|
linux/arm64) export TRIPLET="aarch64-linux-gnu";; \
|
||||||
|
esac && \
|
||||||
|
BITCOIN_URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
|
||||||
|
BITCOIN_FILE="bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
|
||||||
|
wget -qO "${BITCOIN_FILE}" "${BITCOIN_URL}" && \
|
||||||
|
mkdir -p bin && \
|
||||||
|
tar -xzvf "${BITCOIN_FILE}" -C /tmp/bin --strip-components=2 "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-cli" "bitcoin-${BITCOIN_VERSION}/bin/bitcoind" "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-wallet" "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-util"
|
||||||
|
|
||||||
|
FROM debian:buster-slim as custom-signet-bitcoin
|
||||||
|
|
||||||
# Copy the .bashrc file to the container's root directory
|
|
||||||
COPY .bashrc /root/.bashrc
|
|
||||||
|
|
||||||
# Expose necessary ports (update these if needed)
|
ENV BITCOIN_DIR /root/.bitcoin
|
||||||
EXPOSE 18443
|
|
||||||
# EXPOSE 38333
|
|
||||||
|
|
||||||
# Start Bitcoin Core
|
ENV NBITS=${NBITS}
|
||||||
CMD ["/usr/local/bin/generate_signet.sh"]
|
ENV SIGNETCHALLENGE=${SIGNETCHALLENGE}
|
||||||
|
ENV PRIVKEY=${PRIVKEY}
|
||||||
|
|
||||||
|
ENV RPCUSER=${RPCUSER:-"bitcoin"}
|
||||||
|
ENV RPCPASSWORD=${RPCPASSWORD:-"bitcoin"}
|
||||||
|
ENV COOKIEFILE=${COOKIEFILE:-"false"}
|
||||||
|
ENV I2PSAM=${I2PSAM:-""}
|
||||||
|
|
||||||
|
ENV UACOMMENT=${UACOMMENT:-"CustomSignet"}
|
||||||
|
ENV ZMQPUBRAWBLOCK=${ZMQPUBRAWBLOCK:-"tcp://0.0.0.0:28332"}
|
||||||
|
ENV ZMQPUBRAWTX=${ZMQPUBRAWTX:-"tcp://0.0.0.0:28333"}
|
||||||
|
ENV ZMQPUBHASHBLOCK=${ZMQPUBHASHBLOCK:-"tcp://0.0.0.0:28334"}
|
||||||
|
|
||||||
|
ENV RPCBIND=${RPCBIND:-"0.0.0.0:38332"}
|
||||||
|
ENV RPCALLOWIP=${RPCALLOWIP:-"0.0.0.0/0"}
|
||||||
|
ENV WHITELIST=${WHITELIST:-"0.0.0.0/0"}
|
||||||
|
ENV ADDNODE=${ADDNODE:-""}
|
||||||
|
ENV BLOCKPRODUCTIONDELAY=${BLOCKPRODUCTIONDELAY:-""}
|
||||||
|
ENV MINERENABLED=${MINERENABLED:-"1"}
|
||||||
|
ENV MINETO=${MINETO:-""}
|
||||||
|
ENV EXTERNAL_IP=${EXTERNAL_IP:-""}
|
||||||
|
|
||||||
|
VOLUME $BITCOIN_DIR
|
||||||
|
EXPOSE 28332 28333 28334 38332 38333 38334
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -qq --no-install-recommends procps python3 python3-pip jq && \
|
||||||
|
apt-get clean
|
||||||
|
COPY --from=builder "/tmp/bin" /usr/local/bin
|
||||||
|
COPY docker-entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
COPY miner /usr/local/bin/miner
|
||||||
|
COPY *.sh /usr/local/bin/
|
||||||
|
COPY rpcauth.py /usr/local/bin/rpcauth.py
|
||||||
|
RUN pip3 install setuptools
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||||
|
|
||||||
|
CMD ["run.sh"]
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
|
shutdown_gracefully(){
|
||||||
|
|
||||||
|
echo "Container is shutting down, lets make sure bitcoind flushes the db."
|
||||||
|
bitcoin-cli stop
|
||||||
|
sleep 5
|
||||||
|
}
|
||||||
|
trap shutdown_gracefully SIGTERM SIGHUP SIGQUIT SIGINT
|
||||||
|
|
||||||
|
mkdir -p "${BITCOIN_DIR}"
|
||||||
|
# check if this is first run if so run init if config
|
||||||
|
if [[ ! -f "${BITCOIN_DIR}/install_done" ]]; then
|
||||||
|
echo "install_done file not found, running install.sh."
|
||||||
|
install.sh #this is config based on args passed into mining node or peer.
|
||||||
|
else
|
||||||
|
echo "install_done file exists, skipping setup process."
|
||||||
|
echo "rewrite bitcoin.conf"
|
||||||
|
gen-bitcoind-conf.sh >~/.bitcoin/bitcoin.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
$@ &
|
||||||
|
echo "Infinate loop"
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
tail -f /dev/null & wait ${!}
|
||||||
|
done
|
||||||
@ -49,15 +49,4 @@ fi
|
|||||||
|
|
||||||
if [[ "$I2PSAM" != "" ]]; then
|
if [[ "$I2PSAM" != "" ]]; then
|
||||||
echo "i2psam=$I2PSAM"
|
echo "i2psam=$I2PSAM"
|
||||||
fi
|
|
||||||
if [[ "$ONIONPROXY" != "" ]]; then
|
|
||||||
echo "onion=$ONIONPROXY" # unless have static IP won't resolve the control port as domain
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$TORPASSWORD" != "" ]]; then
|
|
||||||
echo "torpassword=$TORPASSWORD"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$TORCONTROL" != "" ]]; then
|
|
||||||
echo "torcontrol=$TORCONTROL"
|
|
||||||
fi
|
fi
|
||||||
Loading…
x
Reference in New Issue
Block a user