From 07c16313d42835a96051dcc676f7538b9b371b6d Mon Sep 17 00:00:00 2001 From: Damian Mee Date: Sun, 18 Aug 2019 23:55:10 +0700 Subject: [PATCH] =?UTF-8?q?It's=20a=20mess.=20=20I=20know.=20=20I=20promis?= =?UTF-8?q?e=20I'll=20fix=20it=20=F0=9F=99=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dockerarm.yml | 6 +- .github/workflows/dockerimage.yml | 8 +- 0.18/source-native/Dockerfile | 131 ++++++++++++++++++++++++++++ 0.18/source-native/Dockerfile.part2 | 53 +++++++++++ 0.18/source/Dockerfile | 107 ++++++++++++----------- 0.18/source/Dockerfile.part2 | 53 +++++++++++ 6 files changed, 304 insertions(+), 54 deletions(-) create mode 100644 0.18/source-native/Dockerfile create mode 100644 0.18/source-native/Dockerfile.part2 create mode 100644 0.18/source/Dockerfile.part2 diff --git a/.github/workflows/dockerarm.yml b/.github/workflows/dockerarm.yml index 186f548..3500205 100644 --- a/.github/workflows/dockerarm.yml +++ b/.github/workflows/dockerarm.yml @@ -7,5 +7,7 @@ jobs: - uses: actions/checkout@master - name: Register self-compiled qemu run: docker run --rm --privileged meedamian/simple-qemu-test:minimal --reset -p yes - - name: Build the Docker image - run: docker build . --file 0.18/source/Dockerfile --tag bitcoind:arm-$(date +%s) + - name: Start building the Docker image (1st part) + run: docker images && docker build -t partial-bitcoind-arm 0.18/source/Dockerfile + - name: Complete the Docker image (2snd part) + run: docker images && docker build -t bitcoind-arm 0.18/source/Dockerfile.part2 diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml index 394f4e4..20dfd86 100644 --- a/.github/workflows/dockerimage.yml +++ b/.github/workflows/dockerimage.yml @@ -4,6 +4,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: Build the Docker image - run: docker build . --file 0.17/Dockerfile --tag bitcoind:$(date +%s) + - uses: actions/checkout@master + - name: Start building the Docker image (1st part) + run: docker images && docker build -t partial-bitcoind-amd64 0.18/source-native/Dockerfile + - name: Complete the Docker image (2snd part) + run: docker images && docker build -t bitcoind-amd64 0.18/source-native/Dockerfile.part2 diff --git a/0.18/source-native/Dockerfile b/0.18/source-native/Dockerfile new file mode 100644 index 0000000..bfa64e7 --- /dev/null +++ b/0.18/source-native/Dockerfile @@ -0,0 +1,131 @@ +# Build stage for Bitcoin Core +FROM alpine:3.10 AS bitcoin-core + +# Because sometimes this happens on emulated architectures: +# https://github.com/bitcoin/bitcoin/issues/14948 +ENV LC_ALL=C.UTF-8 + +# fetch already built berkeleydb +COPY --from=lncm/berkeleydb:db-4.8.30.NC /opt /opt + + +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories + +# install packages necessary to build Bitcoind +RUN apk add --no-cache --update \ + autoconf \ + automake \ + boost-dev \ + build-base \ + chrpath \ + file \ + gnupg \ + libevent-dev \ + libressl \ + libressl-dev \ + libtool \ + linux-headers \ + protobuf-dev \ + zeromq-dev + +RUN set -ex \ + && for key in \ + 90C8019E36C2E964 \ + ; do \ + gpg --keyserver pgp.mit.edu --recv-keys "$key" || \ + gpg --keyserver keyserver.pgp.com --recv-keys "$key" || \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ + done + +ENV BITCOIN_VERSION=0.18.1 +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} + +# Download checksums (intentionally different source than source code) +RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc + +# Download source code (intentionally different source than checksums) +RUN wget https://bitcoin.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz + +# Verify that hashes are signed with the previously imported key +RUN gpg --verify SHA256SUMS.asc + +# Verify that downloaded source-code archive has exactly the hash that's provided +RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - + +# Extract +RUN tar -xzf *.tar.gz + +# Change to the extraced directory +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-ccache \ + --with-gui=no \ + --with-utils \ + --with-libs \ + --with-daemon +RUN make + +#RUN make check +#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 arm32v7/alpine:3.10 AS final +# +#LABEL maintainer.0="nolim1t (@nolim1t)" \ +# maintainer.1="Damian Mee (@meeDamian)" +# +#ENV LC_ALL=C.UTF-8 +# +## Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 +#RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +#RUN apk --no-cache --update \ +# add \ +# boost \ +# boost-program_options \ +# libevent \ +# libressl \ +# libzmq \ +# su-exec +# +#ENV BITCOIN_VERSION=0.18.1 +#ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} +#ENV PATH=${BITCOIN_PREFIX}/bin:$PATH +# +#VOLUME /root/.bitcoin +# +#COPY --from=bitcoin-core /opt /opt +# +## REST interface +#EXPOSE 8080 +# +## P2P network (mainnet, testnet & regnet respectively) +#EXPOSE 8333 18333 18444 +# +## RPC interface (mainnet, testnet & regnet respectively) +#EXPOSE 8332 18332 18443 +# +## ZMQ ports (for transactions & blocks respectively) +#EXPOSE 28332 28333 +# +#ENTRYPOINT ["bitcoind"] +#CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/0.18/source-native/Dockerfile.part2 b/0.18/source-native/Dockerfile.part2 new file mode 100644 index 0000000..a2ee8d8 --- /dev/null +++ b/0.18/source-native/Dockerfile.part2 @@ -0,0 +1,53 @@ +FROM partial-bitcoind-amd64 + +RUN make check +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:3.10 AS final + +LABEL maintainer.0="nolim1t (@nolim1t)" \ + maintainer.1="Damian Mee (@meeDamian)" + +ENV LC_ALL=C.UTF-8 + +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN apk --no-cache --update \ + add \ + boost \ + boost-program_options \ + libevent \ + libressl \ + libzmq \ + su-exec + +ENV BITCOIN_VERSION=0.18.1 +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} +ENV PATH=${BITCOIN_PREFIX}/bin:$PATH + +VOLUME /root/.bitcoin + +COPY --from=bitcoin-core /opt /opt + +# REST interface +EXPOSE 8080 + +# P2P network (mainnet, testnet & regnet respectively) +EXPOSE 8333 18333 18444 + +# RPC interface (mainnet, testnet & regnet respectively) +EXPOSE 8332 18332 18443 + +# ZMQ ports (for transactions & blocks respectively) +EXPOSE 28332 28333 + +ENTRYPOINT ["bitcoind"] +CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/0.18/source/Dockerfile b/0.18/source/Dockerfile index ce41be7..8204038 100644 --- a/0.18/source/Dockerfile +++ b/0.18/source/Dockerfile @@ -1,9 +1,14 @@ # Build stage for Bitcoin Core FROM arm32v7/alpine:3.10 AS bitcoin-core +# Because sometimes this happens on emulated architectures: +# https://github.com/bitcoin/bitcoin/issues/14948 +ENV LC_ALL=C.UTF-8 + # fetch already built berkeleydb COPY --from=lncm/berkeleydb:db-4.8.30.NC-linux-arm /opt /opt + # Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories @@ -63,7 +68,7 @@ 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/ \ +RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ --prefix=${BITCOIN_PREFIX} \ --mandir=/usr/share/man \ --disable-ccache \ @@ -71,52 +76,56 @@ RUN ./configure LDFLAGS=-L$(ls -d /opt/db*)/lib/ CPPFLAGS=-I$(ls -d /opt/db*)/in --with-utils \ --with-libs \ --with-daemon -RUN make check -RUN make install +RUN make -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 arm32v7/alpine:3.10 AS final - -LABEL maintainer.0="nolim1t (@nolim1t)" \ - maintainer.1="Damian Mee (@meeDamian)" - -# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 -RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories -RUN apk --no-cache --update \ - add \ - boost \ - boost-program_options \ - libevent \ - libressl \ - libzmq \ - su-exec - -ENV BITCOIN_VERSION=0.18.1 -ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} -ENV PATH=${BITCOIN_PREFIX}/bin:$PATH - -VOLUME /root/.bitcoin - -COPY --from=bitcoin-core /opt /opt - -# REST interface -EXPOSE 8080 - -# P2P network (mainnet, testnet & regnet respectively) -EXPOSE 8333 18333 18444 - -# RPC interface (mainnet, testnet & regnet respectively) -EXPOSE 8332 18332 18443 - -# ZMQ ports (for transactions & blocks respectively) -EXPOSE 28332 28333 - -ENTRYPOINT ["bitcoind"] -CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] +#RUN make check +#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 arm32v7/alpine:3.10 AS final +# +#LABEL maintainer.0="nolim1t (@nolim1t)" \ +# maintainer.1="Damian Mee (@meeDamian)" +# +#ENV LC_ALL=C.UTF-8 +# +## Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 +#RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +#RUN apk --no-cache --update \ +# add \ +# boost \ +# boost-program_options \ +# libevent \ +# libressl \ +# libzmq \ +# su-exec +# +#ENV BITCOIN_VERSION=0.18.1 +#ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} +#ENV PATH=${BITCOIN_PREFIX}/bin:$PATH +# +#VOLUME /root/.bitcoin +# +#COPY --from=bitcoin-core /opt /opt +# +## REST interface +#EXPOSE 8080 +# +## P2P network (mainnet, testnet & regnet respectively) +#EXPOSE 8333 18333 18444 +# +## RPC interface (mainnet, testnet & regnet respectively) +#EXPOSE 8332 18332 18443 +# +## ZMQ ports (for transactions & blocks respectively) +#EXPOSE 28332 28333 +# +#ENTRYPOINT ["bitcoind"] +#CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"] diff --git a/0.18/source/Dockerfile.part2 b/0.18/source/Dockerfile.part2 new file mode 100644 index 0000000..b1d354f --- /dev/null +++ b/0.18/source/Dockerfile.part2 @@ -0,0 +1,53 @@ +FROM partial-bitcoind-arm + +RUN make check +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 arm32v7/alpine:3.10 AS final + +LABEL maintainer.0="nolim1t (@nolim1t)" \ + maintainer.1="Damian Mee (@meeDamian)" + +ENV LC_ALL=C.UTF-8 + +# Use APK repos over HTTPS. See: https://github.com/gliderlabs/docker-alpine/issues/184 +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories +RUN apk --no-cache --update \ + add \ + boost \ + boost-program_options \ + libevent \ + libressl \ + libzmq \ + su-exec + +ENV BITCOIN_VERSION=0.18.1 +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} +ENV PATH=${BITCOIN_PREFIX}/bin:$PATH + +VOLUME /root/.bitcoin + +COPY --from=bitcoin-core /opt /opt + +# REST interface +EXPOSE 8080 + +# P2P network (mainnet, testnet & regnet respectively) +EXPOSE 8333 18333 18444 + +# RPC interface (mainnet, testnet & regnet respectively) +EXPOSE 8332 18332 18443 + +# ZMQ ports (for transactions & blocks respectively) +EXPOSE 28332 28333 + +ENTRYPOINT ["bitcoind"] +CMD ["bitcoind", "-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"]