diff --git a/Dockerfile b/Dockerfile index dbdfc76e..60df1098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ -FROM ubuntu:xenial -MAINTAINER Kyle Manna +FROM ubuntu:22.04 + +ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive ARG USER_ID ARG GROUP_ID @@ -14,31 +16,51 @@ ENV GROUP_ID ${GROUP_ID:-1000} RUN groupadd -g ${GROUP_ID} bitcoin \ && useradd -u ${USER_ID} -g bitcoin -s /bin/bash -m -d /bitcoin bitcoin -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C70EF1F0305A1ADB9986DBD8D46F45428842CE5E && \ - echo "deb http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu xenial main" > /etc/apt/sources.list.d/bitcoin.list - -RUN apt-get update && apt-get install -y --no-install-recommends \ - bitcoind \ +RUN apt-get update && apt-get install -yq \ + build-essential \ + libtool \ + autotools-dev \ + automake \ + pkg-config \ + libssl-dev \ + libevent-dev \ + bsdmainutils \ + python3 \ + libboost-system-dev \ + libboost-filesystem-dev \ + libboost-chrono-dev \ + libboost-program-options-dev \ + libboost-test-dev \ + libboost-thread-dev \ + libzmq3-dev \ + git \ + gosu \ + tor \ && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* -# grab gosu for easy step-down from root -ENV GOSU_VERSION 1.7 -RUN set -x \ - && apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - wget \ - && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ - && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ - && export GNUPGHOME="$(mktemp -d)" \ - && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ - && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ - && rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc \ - && chmod +x /usr/local/bin/gosu \ - && gosu nobody true \ - && apt-get purge -y \ - ca-certificates \ - wget \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN echo "ControlPort 9051" >> /etc/tor/torrc && \ + echo "CookieAuthentication 1" >> /etc/tor/torrc && \ + echo "RunAsDaemon 1" >> /etc/tor/torrc + +# tag v28.1 +ENV BITCOIN_VERSION 32efe850438ef22e2de39e562af557872a402c31 +RUN cd /opt && \ + git clone https://github.com/bitcoin/bitcoin.git && \ + cd bitcoin/ && \ + git checkout "${BITCOIN_VERSION}^{commit}" && \ + ./autogen.sh && \ + ./configure \ + --disable-wallet \ + --without-gui \ + --without-miniupnpc \ + --with-zmq \ + --enable-zmq \ + --disable-tests \ + --disable-bench \ + --disable-fuzz-binary \ + && \ + make -s "-j$(nproc)" && \ + make install ADD ./bin /usr/local/bin diff --git a/bin/btc_init b/bin/btc_init index 37fe5157..4bc729ae 100755 --- a/bin/btc_init +++ b/bin/btc_init @@ -13,6 +13,7 @@ if [ ! -e "$HOME/.bitcoin/bitcoin.conf" ]; then cat < $HOME/.bitcoin/bitcoin.conf disablewallet=${DISABLEWALLET:-1} printtoconsole=${PRINTTOCONSOLE:-1} +rpcallowip=::/0 rpcuser=${RPCUSER:-bitcoinrpc} rpcpassword=${RPCPASSWORD:-`dd if=/dev/urandom bs=33 count=1 2>/dev/null | base64`} EOF diff --git a/bin/btc_oneshot b/bin/btc_oneshot index 54e93a03..f7908ea6 100755 --- a/bin/btc_oneshot +++ b/bin/btc_oneshot @@ -5,10 +5,6 @@ set -ex # Generate bitcoin.conf btc_init -if [ $# -gt 0 ]; then - args=("$@") -else - args=("-rpcallowip=::/0") -fi +tor -f /etc/tor/torrc -exec bitcoind "${args[@]}" +exec bitcoind "$@"