Initial commit
see https://github.com/king-11/vls-containers/pull/1 for the original PR discussion
This commit is contained in:
134
bitcoind/Dockerfile
Normal file
134
bitcoind/Dockerfile
Normal file
@@ -0,0 +1,134 @@
|
||||
# Build stage for Bitcoin Core
|
||||
FROM alpine as bitcoin-core
|
||||
|
||||
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
|
||||
RUN apk add \
|
||||
autoconf \
|
||||
automake \
|
||||
boost-dev \
|
||||
build-base \
|
||||
chrpath \
|
||||
file \
|
||||
gnupg \
|
||||
libevent-dev \
|
||||
libressl \
|
||||
libtool \
|
||||
linux-headers \
|
||||
sqlite-dev \
|
||||
zeromq-dev
|
||||
|
||||
RUN set -ex \
|
||||
&& for key in \
|
||||
152812300785C96444D3334D17565732E08E5E41 \
|
||||
0AD83877C1F0CD1EE9BD660AD7CC770B81FD22A8 \
|
||||
590B7292695AFFA5B672CBB2E13FC145CD3F4304 \
|
||||
28F5900B1BB5D1A4B6B6D1A9ED357015286A333D \
|
||||
637DB1E23370F84AFF88CCE03152347D07DA627C \
|
||||
CFB16E21C950F67FA95E558F2EEB9F5CC09526C1 \
|
||||
F4FC70F07310028424EFC20A8E4256593F177720 \
|
||||
D1DBF2C4B96F2DEBF4C16654410108112E7EA81F \
|
||||
287AE4CA1187C68C08B49CB2D11BD4F33F1DB499 \
|
||||
F9A8737BF4FF5C89C903DF31DD78544CF91B1514 \
|
||||
9DEAE0DC7063249FB05474681E4AED62986CD25D \
|
||||
E463A93F5F3117EEDE6C7316BD02942421F4889F \
|
||||
9D3CC86A72F8494342EA5FD10A41BDC3F4FAFF1C \
|
||||
4DAF18FE948E7A965B30F9457E296D555E7F63A7 \
|
||||
28E72909F1717FE9607754F8A7BEB2621678D37D \
|
||||
74E2DEF5D77260B98BC19438099BAD163C70FBFA \
|
||||
; do \
|
||||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \
|
||||
gpg --batch --keyserver keys.openpgp.org --recv-keys "$key" || \
|
||||
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \
|
||||
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
|
||||
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \
|
||||
done && \
|
||||
wget -O- https://raw.githubusercontent.com/Kvaciral/kvaciral/main/kvaciral.asc | gpg --import
|
||||
|
||||
ENV BITCOIN_VERSION=23.0
|
||||
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
|
||||
|
||||
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS
|
||||
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc
|
||||
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz
|
||||
RUN gpg --verify SHA256SUMS.asc SHA256SUMS
|
||||
RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c -
|
||||
RUN tar -xzf *.tar.gz
|
||||
|
||||
WORKDIR /bitcoin-${BITCOIN_VERSION}
|
||||
|
||||
RUN sed -i '/AC_PREREQ/a\AR_FLAGS=cr' src/univalue/configure.ac
|
||||
RUN sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac
|
||||
RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat.h
|
||||
RUN ./autogen.sh
|
||||
RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \
|
||||
--prefix=${BITCOIN_PREFIX} \
|
||||
--mandir=/usr/share/man \
|
||||
--disable-tests \
|
||||
--disable-bench \
|
||||
--disable-ccache \
|
||||
--with-gui=no \
|
||||
--with-utils \
|
||||
--with-libs \
|
||||
--with-sqlite=yes \
|
||||
--with-daemon
|
||||
RUN make -j`nproc`
|
||||
RUN make install
|
||||
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
|
||||
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
|
||||
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
|
||||
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a
|
||||
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0
|
||||
|
||||
# Build stage for compiled artifacts
|
||||
FROM alpine
|
||||
|
||||
ARG UID=100
|
||||
ARG GID=101
|
||||
|
||||
LABEL maintainer.0="Lakshya Singh (@king-11)" \
|
||||
maintainer.1="Dev Random (@devrandom01)"
|
||||
|
||||
RUN addgroup bitcoin --gid ${GID} --system
|
||||
RUN adduser --uid ${UID} --system bitcoin --ingroup bitcoin
|
||||
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
|
||||
RUN apk --no-cache add \
|
||||
boost-filesystem \
|
||||
boost-system \
|
||||
boost-thread \
|
||||
sqlite-dev \
|
||||
libevent \
|
||||
libzmq
|
||||
|
||||
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
|
||||
ENV BITCOIN_VERSION=23.0
|
||||
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
|
||||
|
||||
COPY --from=bitcoin-core ${BITCOIN_PREFIX}/bin/bitcoin-cli /usr/bin/bitcoin-cli
|
||||
COPY --from=bitcoin-core ${BITCOIN_PREFIX}/bin/bitcoin-tx /usr/bin/bitcoin-tx
|
||||
COPY --from=bitcoin-core ${BITCOIN_PREFIX}/bin/bitcoind /usr/bin/bitcoind
|
||||
|
||||
COPY bitcoind/entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
COPY assets/bitcoin.conf /bitcoin.conf
|
||||
|
||||
COPY bitcoind/healthcheck.sh /healthcheck.sh
|
||||
RUN chmod +x /healthcheck.sh
|
||||
|
||||
VOLUME ["/home/bitcoin/.bitcoin"]
|
||||
|
||||
EXPOSE 8332 8333 18332 18333 18444
|
||||
|
||||
RUN mkdir -p "${BITCOIN_DATA}"
|
||||
RUN chown -R bitcoin:bitcoin "${BITCOIN_DATA}"
|
||||
|
||||
USER bitcoin
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh" ]
|
||||
|
||||
RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}"
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s \
|
||||
CMD ["/bin/sh", "-c", "/healthcheck.sh"]
|
||||
|
||||
CMD ["bitcoind"]
|
||||
13
bitcoind/entrypoint.sh
Executable file
13
bitcoind/entrypoint.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cp -u /bitcoin.conf $BITCOIN_DATA/
|
||||
|
||||
if [ $(echo "$1" | cut -c1) = "-" ]; then
|
||||
echo "$0: assuming arguments for bitcoind"
|
||||
|
||||
set -- bitcoind "$@"
|
||||
fi
|
||||
|
||||
echo
|
||||
exec "$@"
|
||||
1
bitcoind/healthcheck.sh
Executable file
1
bitcoind/healthcheck.sh
Executable file
@@ -0,0 +1 @@
|
||||
bitcoin-cli --chain=$BITCOIN_CHAIN getblockchaininfo
|
||||
Reference in New Issue
Block a user