|
2 | 2 | FROM alpine:3.21 as bitcoin-core |
3 | 3 |
|
4 | 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 |
| 5 | +RUN apk --no-cache add ccache |
| 6 | +RUN apk --no-cache add cmake |
| 7 | +RUN apk --no-cache add clang18 |
7 | 8 | RUN apk --no-cache add boost-dev |
8 | 9 | RUN apk --no-cache add build-base |
9 | 10 | RUN apk --no-cache add chrpath |
@@ -41,24 +42,27 @@ RUN set -ex \ |
41 | 42 |
|
42 | 43 | WORKDIR "${BITCOIN_SOURCE_DIR}/bitcoin-${BITCOIN_VERSION}" |
43 | 44 |
|
44 | | -RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat/compat.h |
45 | | -RUN ./autogen.sh |
46 | | -RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \ |
47 | | - --prefix=${BITCOIN_PREFIX} \ |
48 | | - --mandir=/usr/share/man \ |
49 | | - --disable-tests \ |
50 | | - --disable-bench \ |
51 | | - --disable-ccache \ |
52 | | - --with-gui=no \ |
53 | | - --with-utils \ |
54 | | - --with-libs \ |
55 | | - --with-sqlite=yes \ |
56 | | - --with-daemon |
57 | | -RUN make -j4 |
58 | | -RUN make install |
59 | | -RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli |
60 | | -RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx |
61 | | -RUN strip ${BITCOIN_PREFIX}/bin/bitcoind |
| 45 | +# use cmake build |
| 46 | +# https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Autotools-to-CMake-Options-Mapping |
| 47 | + |
| 48 | +RUN cmake -B build \ |
| 49 | + -DBUILD_TESTS=OFF \ |
| 50 | + -DBUILD_BENCH=OFF \ |
| 51 | + -DWITH_CCACHE=ON \ |
| 52 | + -DBUILD_GUI=OFF \ |
| 53 | + -DBUILD_CLI=ON \ |
| 54 | + -DBUILD_TX=ON \ |
| 55 | + -DBUILD_UTIL=ON \ |
| 56 | + -DENABLE_WALLET=ON \ |
| 57 | + -DBUILD_DAEMON=ON \ |
| 58 | + # CMAKE VAR |
| 59 | + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 60 | + -DCMAKE_CXX_COMPILER=clang++-18 \ |
| 61 | + -DCMAKE_C_COMPILER=clang-18 \ |
| 62 | + -DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" && \ |
| 63 | + cmake --build build -j$(nproc) && \ |
| 64 | + strip build/bin/bitcoin-cli build/bin/bitcoin-tx build/bin/bitcoind && \ |
| 65 | + cmake --install build |
62 | 66 |
|
63 | 67 | # Build stage for compiled artifacts |
64 | 68 | FROM alpine:3.21 |
@@ -97,6 +101,6 @@ EXPOSE 8332 8333 18332 18333 18444 |
97 | 101 |
|
98 | 102 | ENTRYPOINT ["/entrypoint.sh"] |
99 | 103 |
|
100 | | -RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}" |
| 104 | +RUN bitcoind -version | grep "Bitcoin Core daemon version v${BITCOIN_VERSION}" |
101 | 105 |
|
102 | 106 | CMD ["bitcoind"] |
0 commit comments