22FROM alpine:3.21 as bitcoin-core
33
44RUN 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 boost-dev
8- RUN apk --no-cache add build-base
9- RUN apk --no-cache add chrpath
10- RUN apk --no-cache add file
11- RUN apk --no-cache add gnupg
12- RUN apk --no-cache add git
13- RUN apk --no-cache add libevent-dev
14- RUN apk --no-cache add libressl
15- RUN apk --no-cache add libtool
16- RUN apk --no-cache add linux-headers
17- RUN apk --no-cache add sqlite-dev
18- RUN apk --no-cache add zeromq-dev
5+ RUN apk --no-cache add \
6+ boost-dev \
7+ build-base \
8+ ccache \
9+ chrpath \
10+ clang18 \
11+ cmake \
12+ file \
13+ gnupg \
14+ git \
15+ libevent-dev \
16+ libressl \
17+ libtool \
18+ linux-headers \
19+ sqlite-dev \
20+ zeromq-dev
1921
2022ENV BITCOIN_VERSION=29.0
2123ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
@@ -41,24 +43,27 @@ RUN set -ex \
4143
4244WORKDIR "${BITCOIN_SOURCE_DIR}/bitcoin-${BITCOIN_VERSION}"
4345
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
46+ # use cmake build
47+ # https://github.com/bitcoin-core/bitcoin-devwiki/wiki/Autotools-to-CMake-Options-Mapping
48+
49+ RUN cmake -B build \
50+ -DBUILD_TESTS=OFF \
51+ -DBUILD_BENCH=OFF \
52+ -DWITH_CCACHE=ON \
53+ # -DBUILD_GUI=OFF \
54+ -DBUILD_CLI=ON \
55+ -DBUILD_TX=ON \
56+ -DBUILD_UTIL=ON \
57+ -DENABLE_WALLET=ON \
58+ -DBUILD_DAEMON=ON \
59+ # CMAKE VAR
60+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
61+ -DCMAKE_CXX_COMPILER=clang++-18 \
62+ -DCMAKE_C_COMPILER=clang-18 \
63+ -DCMAKE_INSTALL_PREFIX:PATH="${BITCOIN_PREFIX}" && \
64+ cmake --build build -j$(nproc) && \
65+ strip build/bin/bitcoin-cli build/bin/bitcoin-tx build/bin/bitcoind && \
66+ cmake --install build
6267
6368# Build stage for compiled artifacts
6469FROM alpine:3.21
0 commit comments