Skip to content

Commit 8858ec0

Browse files
lnlizAaronDewes
andauthored
add 27.1, 27.2 and 28.0, use alpine:3.20 (#105)
Co-authored-by: Aaron Dewes <[email protected]>
1 parent 9098cc7 commit 8858ec0

File tree

6 files changed

+959
-4
lines changed

6 files changed

+959
-4
lines changed

.github/workflows/single-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
DOCKER_BUILDKIT: 1
2727

2828
steps:
29-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v4
3030

3131
- name: Detect version
3232
run: echo ::set-env name=MINOR::"$(echo "$GITHUB_REF" | sed -E 's|refs/heads/v(.*)-test|\1|g')"

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
subver:
21-
- '24.0'
22-
- '25.1'
2321
- '26.1'
2422
- '27.0'
23+
- '27.1'
24+
- '27.2'
25+
- '28.0'
2526

2627
arch:
2728
- amd64

.github/workflows/update-readme.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-22.04
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v4
1919

2020
- name: Setup Environment
2121
run: echo ::set-env name=SLUG::"$(echo ${GITHUB_REPOSITORY,,} | sed 's/docker-//')"

27.1/Dockerfile

Lines changed: 318 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
# This Dockerfile builds Bitcoin Core and packages it into a minimal `final` image
2+
3+
# VERSION of Bitcoin Core to be build
4+
# NOTE: Unlike our other images this one is NOT prefixed with `v`,
5+
# as many things (like download URLs) use this form instead.
6+
ARG VERSION=27.1
7+
8+
# CPU architecture to build binaries for
9+
ARG ARCH
10+
11+
# Define default versions so that they don't have to be repeated throughout the file
12+
ARG VER_ALPINE=3.20
13+
14+
# $USER name, and data $DIR to be used in the `final` image
15+
ARG USER=bitcoind
16+
ARG DIR=/data
17+
18+
# Choose where to get bitcoind sources from, options: release, git
19+
# NOTE: Only `SOURCE=git` can be used for RC releases
20+
ARG SOURCE=release
21+
22+
# Choose where to get BerkeleyDB from, options: prebuilt, compile
23+
# NOTE: When compiled here total execution time exceeds allowed CI limits, so pre-built one is used by default
24+
ARG BDB_SOURCE=prebuilt
25+
26+
27+
28+
#
29+
## `preparer-base` installs dependencies needed by both ways of fetching the source,
30+
# as well as imports GPG keys needed to verify authenticity of the source.
31+
#
32+
FROM alpine:${VER_ALPINE} AS preparer-base
33+
34+
RUN apk add --no-cache gnupg
35+
36+
# Guix Builder Keys: https://github.com/bitcoin-core/guix.sigs/tree/main/builder-keys
37+
# curl -s "https://api.github.com/repos/bitcoin-core/guix.sigs/contents/builder-keys" | jq -r '.[].download_url'
38+
ENV KEYS 982A193E3CE0EED535E09023188CBB2648416AD5 \
39+
0CCBAAFD76A2ECE2CCD3141DE2FFD5B1D88CA97D \
40+
8D8F44B041CC745A8066356ACB498A7685A3203C \
41+
1A6B4BBC2051B1BFC3F0791EA096238A5DA7EF4C \
42+
101598DC823C1B5F9A6624ABA5E0907A0380E6C3 \
43+
A9206D4BD08A30A143638C0E8B96345BBE7DED9B \
44+
9EDAFF80E080659604F4A76B2EBB056FD847F8A7 \
45+
637DB1E23370F84AFF88CCE03152347D07DA627C \
46+
28EB13F9FD58CE86EAAB091470596D7FF6B55417 \
47+
344219055D59453CD50531CD918A89D210E96167 \
48+
ED9BDF7AD6A55E232E84524257FF9BDBCC301009 \
49+
A45E76B5A378425DA632394D498A18F9F6BB9174 \
50+
A8FC55F3B04BA3146F3492E79303B33A305224CB \
51+
F2CFC4ABD0B99D837EEBB7D09B79B45691DB4173 \
52+
0E995DC8033FC9AAD72FDE75DAB71C6FBCD75257 \
53+
204A972AEA7378C6A07466EA7651CCCB55BC4D56 \
54+
152812300785C96444D3334D17565732E08E5E41 \
55+
775F1492D89554798BD56C5ADB88DB0BD2EDFBFC \
56+
0AD83877C1F0CD1EE9BD660AD7CC770B81FD22A8 \
57+
1DECC0766F51B043631DBC10DA8AD98074B460CF \
58+
C060A6635913D98A3587D7DB1C2491FFEB0EF770 \
59+
FEF325F44FDAAD6683C539D9BBA4F02DB4D99E1B \
60+
590B7292695AFFA5B672CBB2E13FC145CD3F4304 \
61+
1379CCD299E669C69E123F67544918F147B456C8 \
62+
6F9EFB2418B22D9ADC1644082E2755CCCB9A664C \
63+
41E442A14C342C877AE4DC8F3B6305FA06DE51D5 \
64+
73D29D1549135479C20B6F28640997BD69CA9269 \
65+
948444FCE03B05BA5AB0591EC37B1C1D44C786EE \
66+
28F5900B1BB5D1A4B6B6D1A9ED357015286A333D \
67+
722F9A1F3799224545C6CB90A0455D5134A863A6 \
68+
0E2A0B287346F54827B31D7354EFB3298283B289 \
69+
E777299FC265DD04793070EB944D35F9AC3DB76A \
70+
CFB16E21C950F67FA95E558F2EEB9F5CC09526C1 \
71+
6B002C6EA3F91B1B0DF0C9BC8F617F1200A6D25C \
72+
ED34FD4058F41840A165D65EA7B1C35A8424C4E5 \
73+
F19F5FF2B0589EC341220045BA03F4DBE0C63FB4 \
74+
D32EDBC31403E064D202B631F516F495EBEBFDCD \
75+
F4FC70F07310028424EFC20A8E4256593F177720 \
76+
F3FDEEDE46A8A2EC139098ED5E50C90D766DB9FC \
77+
0B7507D8139F9DB3587053BA6376F16B3C9F08CC \
78+
6E01EEC9656903B0542B8F1003DB6322267C373B \
79+
2C7185B3E7454C06D76635694F50789ED785C6D4 \
80+
A1A8B25E6185BB18DBAFA60D5F227E08FA339C20 \
81+
973730D55793F2DEF00B60DA63B65BEF7899D597 \
82+
C25F3295638298E3AFEBE70B48F5EB2E7E59AF8C \
83+
B14D3C5CA570F03C911E04A6F0A0ED07755FDBCF \
84+
E6DF8502529F86B491C65E1E988BB7626335E3FB \
85+
FDE04B7075113BFB085020B57BBD8D4D95DB9F03 \
86+
D1DBF2C4B96F2DEBF4C16654410108112E7EA81F \
87+
CBE89ED88EE8525FD8D79F1EDB56ADFD8B5EF498 \
88+
287AE4CA1187C68C08B49CB2D11BD4F33F1DB499 \
89+
4FD6BAE4CAB7261734558654F3BD809A19B82259 \
90+
616516B8EB6ED02882FC4A7A8ADCB558C4F33D65 \
91+
5C9C707EB7D6FCB75BA1225F6A671EE7D00D38C3 \
92+
C388F6961FB972A95678E327F62711DBDCA8AE56 \
93+
49DAC1BDFBEB6B26B794904EC08D36845BA9A59F \
94+
71A3B16735405025D447E8F274810B012346C9A6 \
95+
9DEAE0DC7063249FB05474681E4AED62986CD25D \
96+
53D974DA0BAFFF22B3A5FB5C69B4C4CDC628F8F9 \
97+
D01B5D68015444D271DAD33FF69705ED890DE427 \
98+
1A3E761F19D2CC7785C5502EA291A2C45D0C504A \
99+
DB79C612764A580E4BB71BB82B50B0C9E93DB62F \
100+
E86AE73439625BBEE306AAE6B66D427F873CB1A3 \
101+
45741E495E214C428E8FFF58AC742749DC4965AB \
102+
E61773CD6E01040E2F1BD78CE7E2984B6289C93A \
103+
CBDB447184AC2CA7A121A27907052EE640FEAC22 \
104+
2F78ACF677029767C8736F13747A7AE2FB0FD25B \
105+
E58DC1C0A44E0D8E6397D442A54BAA02E69D78D6 \
106+
133EAC179436F14A5CF1B794860FEB804E669320 \
107+
3F1888C6DCA92A6499C4911FDBA1A67379A1A931 \
108+
5ADAB999CE5240DD68F9A079A5210C1621239EFB \
109+
AF9167ECC5FB492B9841E276BD991B3EC4EB3A28 \
110+
9199E2D71F37DC34BD2337C988AF5B9A92EC92CD \
111+
AC6626172E00A82CFFAE8972A636E97631F767E0 \
112+
02E82CC36166CAA5F6E623EFB224E825176C0F32 \
113+
3EB0DEE6004A13BE5A0CC758BF2978B068054311 \
114+
9ED99C7A355AE46098103E74476E74C8529A9006 \
115+
0164F03C54C2176A14D1997DFF5C9E3F8ACAF77A \
116+
670BC460DC8BF5EEF1C3BC74B14CC9F833238F85 \
117+
6A8F9C266528E25AEB1D7731C2371D91CB716EA7 \
118+
9343A22960A50972CC1EFD7DB3B5CB8DB648B27F \
119+
28E72909F1717FE9607754F8A7BEB2621678D37D \
120+
032703671E4ACE58DB7FA2D3BBE369B6789ADBDB \
121+
67AA5B46E7AF78053167FE343B8F814A784218F8 \
122+
D6D11C357A614D40803ABDC4105F2EA76D0102CA \
123+
6EEEF78796B8B5409719A2A36D498CBADF3906B8 \
124+
A0083660F235A27000CD3C81CE6EC49945C17EA6 \
125+
79D00BAC68B56D422F945A8F8E3A8F3247DBCBBF \
126+
B9069CB5D5FB01A66D69E01BC990468AFE0F55CD \
127+
8EA063F7D5E6E17ADE409BDC605192A3FE984A60
128+
129+
RUN gpg --keyserver keyserver.ubuntu.com --recv-keys $KEYS
130+
131+
#
132+
## Option #1: [default] Fetch bitcoind source from release tarballs
133+
#
134+
FROM preparer-base AS preparer-release
135+
136+
ARG VERSION
137+
138+
# Download sigs
139+
ADD https://bitcoincore.org/bin/bitcoin-core-$VERSION/SHA256SUMS.asc ./
140+
# Download checksums
141+
ADD https://bitcoincore.org/bin/bitcoin-core-$VERSION/SHA256SUMS ./
142+
143+
# Download source code from same website as github is probably deterministicly built
144+
ADD https://bitcoincore.org/bin/bitcoin-core-$VERSION/bitcoin-$VERSION.tar.gz ./bitcoin-$VERSION.tar.gz
145+
146+
# Verify that hashes are signed with the previously imported key
147+
RUN gpg --verify SHA256SUMS.asc SHA256SUMS
148+
149+
# Verify that downloaded source-code archive matches exactly the hash that's provided
150+
RUN grep "bitcoin-$VERSION.tar.gz" SHA256SUMS | sha256sum -c
151+
152+
# Extract
153+
RUN tar -xzf "bitcoin-$VERSION.tar.gz" && \
154+
rm -f "bitcoin-$VERSION.tar.gz"
155+
156+
#
157+
## Option #2: Fetch bitcoind source from GitHub
158+
#
159+
FROM preparer-base AS preparer-git
160+
161+
ARG VERSION
162+
163+
RUN apk add --no-cache git
164+
165+
# Fetch the source code at a specific TAG
166+
RUN git clone -b "v$VERSION" --depth=1 https://github.com/bitcoin/bitcoin.git "/bitcoin-$VERSION/"
167+
168+
# Verify tag, and copy source code to predetermined location on success
169+
RUN cd "/bitcoin-$VERSION/" && \
170+
git verify-tag "v$VERSION"
171+
172+
173+
174+
#
175+
## Alias to go around `COPY` not accepting ARGs in value passed to `--from=`
176+
#
177+
FROM preparer-${SOURCE} AS preparer
178+
179+
180+
181+
#
182+
## `berkeleydb-prebuilt` downloads a pre-built BerkeleyDB to make sure
183+
# the overall build time of this Dockerfile fits within CI limits.
184+
#
185+
FROM lncm/berkeleydb:v4.8.30.NC${ARCH:+-${ARCH}} AS berkeleydb-prebuilt
186+
187+
#
188+
## `berkeleydb-compile` builds BerkeleyDB from source using script provided in bitcoind repo.
189+
#
190+
FROM alpine:${VER_ALPINE} AS berkeleydb-compile
191+
# TODO: implement ^^
192+
RUN echo "Not implemented" && exit 1
193+
194+
195+
FROM berkeleydb-${BDB_SOURCE} AS berkeleydb
196+
197+
198+
199+
#
200+
## `builder` builds Bitcoin Core regardless on how the source, and BDB code were obtained.
201+
#
202+
# NOTE: this stage is emulated using QEMU
203+
# NOTE: `${ARCH:+${ARCH}/}` - if ARCH is set, append `/` to it, leave it empty otherwise
204+
FROM ${ARCH:+${ARCH}/}alpine:${VER_ALPINE} AS builder
205+
206+
ARG VERSION
207+
ARG SOURCE
208+
209+
RUN apk add --no-cache \
210+
autoconf \
211+
automake \
212+
boost-dev \
213+
sqlite-dev \
214+
build-base \
215+
chrpath \
216+
file \
217+
libevent-dev \
218+
libressl \
219+
libtool \
220+
linux-headers \
221+
zeromq-dev
222+
223+
# Fetch pre-built berkeleydb
224+
COPY --from=berkeleydb /opt/ /opt/
225+
226+
# Change to the extracted directory
227+
WORKDIR /bitcoin-$VERSION/
228+
229+
# Copy bitcoin source (downloaded & verified in previous stages)
230+
COPY --from=preparer /bitcoin-$VERSION/ ./
231+
232+
ENV BITCOIN_PREFIX /opt/bitcoin-$VERSION
233+
234+
RUN ./autogen.sh
235+
236+
# TODO: Try to optimize on passed params
237+
RUN ./configure LDFLAGS=-L/opt/db4/lib/ CPPFLAGS=-I/opt/db4/include/ \
238+
CXXFLAGS="-O2" \
239+
--prefix="$BITCOIN_PREFIX" \
240+
--disable-man \
241+
--disable-shared \
242+
--disable-ccache \
243+
--disable-tests \
244+
--disable-bench \
245+
--enable-static \
246+
--enable-reduce-exports \
247+
--enable-fuzz-binary=no \
248+
--without-gui \
249+
--without-libs \
250+
--with-utils \
251+
--with-sqlite=yes \
252+
--with-daemon
253+
254+
RUN make -j$(( $(nproc) + 1 ))
255+
RUN make install
256+
257+
# List installed binaries pre-strip & strip them
258+
RUN ls -lh "$BITCOIN_PREFIX/bin/"
259+
RUN strip -v "$BITCOIN_PREFIX/bin/bitcoin"*
260+
261+
# List installed binaries post-strip & print their checksums
262+
RUN ls -lh "$BITCOIN_PREFIX/bin/"
263+
RUN sha256sum "$BITCOIN_PREFIX/bin/bitcoin"*
264+
265+
266+
267+
#
268+
## `final` aggregates build results from previous stages into a necessary minimum
269+
# ready to be used, and published to Docker Hub.
270+
#
271+
# NOTE: this stage is emulated using QEMU
272+
# NOTE: `${ARCH:+${ARCH}/}` - if ARCH is set, append `/` to it, leave it empty otherwise
273+
FROM ${ARCH:+${ARCH}/}alpine:${VER_ALPINE} AS final
274+
275+
ARG VERSION
276+
ARG USER
277+
ARG DIR
278+
279+
LABEL maintainer="Damian Mee (@meeDamian)"
280+
281+
RUN apk add --no-cache \
282+
libevent \
283+
libsodium \
284+
libstdc++ \
285+
libzmq \
286+
sqlite-libs
287+
288+
COPY --from=builder /opt/bitcoin-$VERSION/bin/bitcoin* /usr/local/bin/
289+
290+
# NOTE: Default GID == UID == 1000
291+
RUN adduser --disabled-password \
292+
--home "$DIR/" \
293+
--gecos "" \
294+
"$USER"
295+
296+
USER $USER
297+
298+
# Prevents `VOLUME $DIR/.bitcoind/` being created as owned by `root`
299+
RUN mkdir -p "$DIR/.bitcoin/"
300+
301+
# Expose volume containing all `bitcoind` data
302+
VOLUME $DIR/.bitcoin/
303+
304+
# REST interface
305+
EXPOSE 8080
306+
307+
# P2P network (mainnet, testnet & regnet respectively)
308+
EXPOSE 8333 18333 18444
309+
310+
# RPC interface (mainnet, testnet & regnet respectively)
311+
EXPOSE 8332 18332 18443
312+
313+
# ZMQ ports (for transactions & blocks respectively)
314+
EXPOSE 28332 28333
315+
316+
ENTRYPOINT ["bitcoind"]
317+
318+
CMD ["-zmqpubrawblock=tcp://0.0.0.0:28332", "-zmqpubrawtx=tcp://0.0.0.0:28333"]

0 commit comments

Comments
 (0)