|
| 1 | +# Build stage for BerkeleyDB |
| 2 | +FROM alpine:3.7 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 openssl |
| 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} |
| 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:3.7 as bitcoin-core |
| 27 | + |
| 28 | +COPY --from=berkeleydb /opt /opt |
| 29 | + |
| 30 | +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories |
| 31 | +RUN apk --no-cache add autoconf |
| 32 | +RUN apk --no-cache add automake |
| 33 | +RUN apk --no-cache add boost-dev |
| 34 | +RUN apk --no-cache add build-base |
| 35 | +RUN apk --no-cache add ca-certificates |
| 36 | +RUN apk --no-cache add chrpath |
| 37 | +RUN apk --no-cache add curl |
| 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 openssl |
| 42 | +RUN apk --no-cache add openssl-dev |
| 43 | +RUN apk --no-cache add libtool |
| 44 | +RUN apk --no-cache add linux-headers |
| 45 | +RUN apk --no-cache add protobuf-dev |
| 46 | +RUN apk --no-cache add zeromq-dev |
| 47 | +RUN set -ex \ |
| 48 | + && for key in \ |
| 49 | + 90C8019E36C2E964 \ |
| 50 | + ; do \ |
| 51 | + gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \ |
| 52 | + gpg --batch --keyserver pgp.mit.edu --recv-keys "$key" || \ |
| 53 | + gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \ |
| 54 | + gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \ |
| 55 | + gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" ; \ |
| 56 | + done |
| 57 | + |
| 58 | +# Workaround for Let's Encrypt DST Root CA X3 expiration. |
| 59 | +RUN sed -i 's#mozilla\/DST_Root_CA_X3.crt#!mozilla\/DST_Root_CA_X3.crt#g' /etc/ca-certificates.conf |
| 60 | +RUN update-ca-certificates |
| 61 | + |
| 62 | +ENV BITCOIN_VERSION=0.11.2 |
| 63 | +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} |
| 64 | + |
| 65 | +RUN curl -O https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc |
| 66 | +RUN curl -O https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz |
| 67 | +RUN gpg --verify SHA256SUMS.asc |
| 68 | +RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS.asc | sha256sum -c - |
| 69 | +RUN tar -xzf *.tar.gz |
| 70 | + |
| 71 | +WORKDIR /bitcoin-${BITCOIN_VERSION} |
| 72 | + |
| 73 | +COPY patches/warnings.patch /warnings.patch |
| 74 | + |
| 75 | +RUN patch -p0 < /warnings.patch |
| 76 | +RUN ./autogen.sh |
| 77 | +RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ |
| 78 | + --prefix=${BITCOIN_PREFIX} \ |
| 79 | + --mandir=/usr/share/man \ |
| 80 | + --disable-tests \ |
| 81 | + --disable-bench \ |
| 82 | + --disable-ccache \ |
| 83 | + --with-gui=no \ |
| 84 | + --with-utils \ |
| 85 | + --with-libs \ |
| 86 | + --with-daemon |
| 87 | +RUN make -j4 |
| 88 | +RUN make install |
| 89 | +RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli |
| 90 | +RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx |
| 91 | +RUN strip ${BITCOIN_PREFIX}/bin/bitcoind |
| 92 | +RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a |
| 93 | +RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0 |
| 94 | + |
| 95 | +# Build stage for compiled artifacts |
| 96 | +FROM alpine:3.7 |
| 97 | + |
| 98 | +LABEL maintainer.0="Will Clark (@willcl-ark)" |
| 99 | + |
| 100 | +RUN addgroup -S bitcoin |
| 101 | +RUN adduser -G bitcoin -H -S bitcoin |
| 102 | +RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories |
| 103 | +RUN apk --no-cache add \ |
| 104 | + boost \ |
| 105 | + boost-program_options \ |
| 106 | + libevent \ |
| 107 | + openssl \ |
| 108 | + libzmq \ |
| 109 | + shadow \ |
| 110 | + su-exec |
| 111 | + |
| 112 | +ENV BITCOIN_DATA=/home/bitcoin/.bitcoin |
| 113 | +ENV BITCOIN_VERSION=0.11.2 |
| 114 | +ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION} |
| 115 | +ENV PATH=${BITCOIN_PREFIX}/bin:$PATH |
| 116 | + |
| 117 | +COPY --from=bitcoin-core /opt /opt |
| 118 | +COPY docker-entrypoint.sh /entrypoint.sh |
| 119 | + |
| 120 | +VOLUME ["/home/bitcoin/.bitcoin"] |
| 121 | + |
| 122 | +EXPOSE 8332 8333 18332 18333 18444 |
| 123 | + |
| 124 | +ENTRYPOINT ["/entrypoint.sh"] |
| 125 | + |
| 126 | +CMD ["bitcoind"] |
0 commit comments