|
| 1 | +# Build stage for BerkeleyDB |
| 2 | +FROM alpine as berkeleydb |
| 3 | + |
| 4 | +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories |
| 5 | +RUN apk --no-cache add autoconf |
| 6 | +RUN apk --no-cache add automake |
| 7 | +RUN apk --no-cache add build-base |
| 8 | +RUN apk --no-cache add libressl |
| 9 | + |
| 10 | +ENV BERKELEYDB_VERSION=db-4.8.30.NC |
| 11 | +ENV BERKELEYDB_PREFIX=/opt/${BERKELEYDB_VERSION} |
| 12 | + |
| 13 | +RUN wget https://download.oracle.com/berkeley-db/${BERKELEYDB_VERSION}.tar.gz |
| 14 | +RUN tar -xzf *.tar.gz |
| 15 | +RUN sed s/__atomic_compare_exchange/__atomic_compare_exchange_db/g -i ${BERKELEYDB_VERSION}/dbinc/atomic.h |
| 16 | +RUN mkdir -p ${BERKELEYDB_PREFIX} |
| 17 | + |
| 18 | +WORKDIR /${BERKELEYDB_VERSION}/build_unix |
| 19 | + |
| 20 | +RUN ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=${BERKELEYDB_PREFIX} --build=aarch64-unknown-linux-gnu |
| 21 | +RUN make -j4 |
| 22 | +RUN make install |
| 23 | +RUN rm -rf ${BERKELEYDB_PREFIX}/docs |
| 24 | + |
| 25 | +# Build stage for Bitcoin Core |
| 26 | +FROM alpine as bitcoin-core |
| 27 | + |
| 28 | +COPY --from=berkeleydb /opt /opt |
| 29 | + |
| 30 | +ENV GNUPGHOME=/tmp/gnupg |
| 31 | + |
| 32 | +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories |
| 33 | +RUN apk --no-cache add autoconf |
| 34 | +RUN apk --no-cache add automake |
| 35 | +RUN apk --no-cache add boost-dev |
| 36 | +RUN apk --no-cache add build-base |
| 37 | +RUN apk --no-cache add chrpath |
| 38 | +RUN apk --no-cache add file |
| 39 | +RUN apk --no-cache add gnupg |
| 40 | +RUN apk --no-cache add libevent-dev |
| 41 | +RUN apk --no-cache add libressl |
| 42 | +RUN apk --no-cache add libtool |
| 43 | +RUN apk --no-cache add linux-headers |
| 44 | +RUN apk --no-cache add sqlite-dev |
| 45 | +RUN apk --no-cache add zeromq-dev |
| 46 | +RUN mkdir -p ${GNUPGHOME} |
| 47 | +RUN set -ex \ |
| 48 | + && for key in \ |
| 49 | + 101598DC823C1B5F9A6624ABA5E0907A0380E6C3 \ |
| 50 | + 6A8F9C266528E25AEB1D7731C2371D91CB716EA7 \ |
| 51 | + 2840EAABF4BC9F0FFD716AFAFBAFCC46DE2D3FE2 \ |
| 52 | + E86AE73439625BBEE306AAE6B66D427F873CB1A3 \ |
| 53 | + A0083660F235A27000CD3C81CE6EC49945C17EA6 \ |
| 54 | + F19F5FF2B0589EC341220045BA03F4DBE0C63FB4 \ |
| 55 | + 637DB1E23370F84AFF88CCE03152347D07DA627C \ |
| 56 | + ED9BDF7AD6A55E232E84524257FF9BDBCC301009 \ |
| 57 | + CFB16E21C950F67FA95E558F2EEB9F5CC09526C1 \ |
| 58 | + 152812300785C96444D3334D17565732E08E5E41 \ |
| 59 | + C388F6961FB972A95678E327F62711DBDCA8AE56 \ |
| 60 | + 9DEAE0DC7063249FB05474681E4AED62986CD25D \ |
| 61 | + D1DBF2C4B96F2DEBF4C16654410108112E7EA81F \ |
| 62 | + ; do \ |
| 63 | + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ |
| 64 | + gpg --batch --keyserver keys.openpgp.org --recv-keys "$key" || \ |
| 65 | + gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ |
| 66 | + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ |
| 67 | + gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ |
| 68 | + done |
| 69 | + |
| 70 | +ENV BITCOIN_VERSION=28.0 |
| 71 | +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} |
| 72 | + |
| 73 | +RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS |
| 74 | +RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc |
| 75 | +RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz |
| 76 | +RUN gpg --verify SHA256SUMS.asc SHA256SUMS |
| 77 | +RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c - |
| 78 | +RUN tar -xzf *.tar.gz |
| 79 | + |
| 80 | +WORKDIR /bitcoin-${BITCOIN_VERSION} |
| 81 | + |
| 82 | +RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat/compat.h |
| 83 | +RUN ./autogen.sh |
| 84 | +RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ |
| 85 | + --prefix=${BITCOIN_PREFIX} \ |
| 86 | + --mandir=/usr/share/man \ |
| 87 | + --disable-tests \ |
| 88 | + --disable-bench \ |
| 89 | + --disable-ccache \ |
| 90 | + --with-gui=no \ |
| 91 | + --with-utils \ |
| 92 | + --with-libs \ |
| 93 | + --with-sqlite=yes \ |
| 94 | + --with-daemon |
| 95 | +RUN make -j4 |
| 96 | +RUN make install |
| 97 | +RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli |
| 98 | +RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx |
| 99 | +RUN strip ${BITCOIN_PREFIX}/bin/bitcoind |
| 100 | +RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a |
| 101 | +RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0 |
| 102 | + |
| 103 | +# Build stage for compiled artifacts |
| 104 | +FROM alpine |
| 105 | + |
| 106 | +ARG UID=100 |
| 107 | +ARG GID=101 |
| 108 | + |
| 109 | +LABEL maintainer.0="João Fonseca (@joaopaulofonseca)" \ |
| 110 | + maintainer.1="Pedro Branco (@pedrobranco)" \ |
| 111 | + maintainer.2="Rui Marinho (@ruimarinho)" |
| 112 | + |
| 113 | +RUN addgroup bitcoin --gid ${GID} --system |
| 114 | +RUN adduser --uid ${UID} --system bitcoin --ingroup bitcoin |
| 115 | +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories |
| 116 | +RUN apk --no-cache add \ |
| 117 | + boost-filesystem \ |
| 118 | + boost-system \ |
| 119 | + boost-thread \ |
| 120 | + libevent \ |
| 121 | + libzmq \ |
| 122 | + shadow \ |
| 123 | + sqlite-dev \ |
| 124 | + su-exec |
| 125 | + |
| 126 | +ENV BITCOIN_DATA=/home/bitcoin/.bitcoin |
| 127 | +ENV BITCOIN_VERSION=28.0 |
| 128 | +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} |
| 129 | +ENV PATH=${BITCOIN_PREFIX}/bin:$PATH |
| 130 | + |
| 131 | +COPY --from=bitcoin-core /opt /opt |
| 132 | +COPY docker-entrypoint.sh /entrypoint.sh |
| 133 | + |
| 134 | +VOLUME ["/home/bitcoin/.bitcoin"] |
| 135 | + |
| 136 | +EXPOSE 8332 8333 18332 18333 18444 |
| 137 | + |
| 138 | +ENTRYPOINT ["/entrypoint.sh"] |
| 139 | + |
| 140 | +RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}" |
| 141 | + |
| 142 | +CMD ["bitcoind"] |
0 commit comments