Skip to content

Commit 2481d87

Browse files
committed
fix: use cmake build bitcoin core 29
1 parent c05a8ca commit 2481d87

File tree

2 files changed

+53
-49
lines changed

2 files changed

+53
-49
lines changed

.github/workflows/bitcoin_core.yaml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ jobs:
1919
strategy:
2020
matrix:
2121
image:
22-
- name: 25-alpine
23-
context: "./25/alpine"
24-
- name: 25-debian
25-
context: "./25/debian"
26-
- name: 25-ubuntu
27-
context: "./25/ubuntu"
28-
- name: 25-lightninglabs-alpine
29-
context: "./25/alpine/lightninglabs"
30-
- name: 26-alpine
31-
context: "./26/alpine"
32-
- name: 26-debian
33-
context: "./26/debian"
34-
- name: 26-ubuntu
35-
context: "./26/ubuntu"
36-
- name: 26-lightninglabs-alpine
37-
context: "./26/alpine/lightninglabs"
38-
- name: 27-alpine
39-
context: "./27/alpine"
40-
- name: 27-debian
41-
context: "./27/debian"
42-
- name: 28-alpine
43-
context: "./28/alpine"
44-
- name: 28-debian
45-
context: "./28/debian"
46-
- name: 28-ubuntu
47-
context: "./28/ubuntu"
48-
#- name: 29-alpine
49-
# context: "./29/alpine"
22+
# - name: 25-alpine
23+
# context: "./25/alpine"
24+
# - name: 25-debian
25+
# context: "./25/debian"
26+
# - name: 25-ubuntu
27+
# context: "./25/ubuntu"
28+
# - name: 25-lightninglabs-alpine
29+
# context: "./25/alpine/lightninglabs"
30+
# - name: 26-alpine
31+
# context: "./26/alpine"
32+
# - name: 26-debian
33+
# context: "./26/debian"
34+
# - name: 26-ubuntu
35+
# context: "./26/ubuntu"
36+
# - name: 26-lightninglabs-alpine
37+
# context: "./26/alpine/lightninglabs"
38+
# - name: 27-alpine
39+
# context: "./27/alpine"
40+
# - name: 27-debian
41+
# context: "./27/debian"
42+
# - name: 28-alpine
43+
# context: "./28/alpine"
44+
# - name: 28-debian
45+
# context: "./28/debian"
46+
# - name: 28-ubuntu
47+
# context: "./28/ubuntu"
48+
- name: 29-alpine
49+
context: "./29/alpine"
5050
#- name: 29-debian
5151
# context: "./29/debian"
5252
#- name: 29-ubuntu

29/alpine/Dockerfile

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
FROM alpine:3.21 as bitcoin-core
33

44
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
78
RUN apk --no-cache add boost-dev
89
RUN apk --no-cache add build-base
910
RUN apk --no-cache add chrpath
@@ -41,24 +42,27 @@ RUN set -ex \
4142

4243
WORKDIR "${BITCOIN_SOURCE_DIR}/bitcoin-${BITCOIN_VERSION}"
4344

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
6266

6367
# Build stage for compiled artifacts
6468
FROM alpine:3.21
@@ -97,6 +101,6 @@ EXPOSE 8332 8333 18332 18333 18444
97101

98102
ENTRYPOINT ["/entrypoint.sh"]
99103

100-
RUN bitcoind -version | grep "Bitcoin Core version v${BITCOIN_VERSION}"
104+
RUN bitcoind -version | grep "Bitcoin Core daemon version v${BITCOIN_VERSION}"
101105

102106
CMD ["bitcoind"]

0 commit comments

Comments
 (0)