1
- FROM ubuntu:20.04 AS builder
1
+ FROM debian:stable-slim as builder
2
+
3
+ # VERSION of BItcoin Core to be build
4
+ ARG VERSION=27.0
2
5
3
6
ENV DEBIAN_FRONTEND=non-interactive
4
7
5
8
RUN apt-get update && apt-get install -y \
6
- automake autotools-dev bsdmainutils build-essential ccache git libboost-dev \
7
- libboost-filesystem-dev libboost-system-dev libboost-test-dev libevent-dev \
8
- libminiupnpc-dev libnatpmp-dev libsqlite3-dev libtool libzmq3-dev pkg-config \
9
- python3 systemtap-sdt-dev
9
+ build-essential \
10
+ automake pkg-config \
11
+ wget curl libzmq3-dev \
12
+ libtool autotools-dev \
13
+ bsdmainutils python3 git \
14
+ libsqlite3-dev libdb-dev \
15
+ libdb++-dev libevent-dev \
16
+ libboost-dev libboost-system-dev \
17
+ libboost-filesystem-dev libboost-test-dev
10
18
11
- RUN git clone https://github.com/ bitcoin/bitcoin.git /bitcoin
19
+ RUN wget -qO- https://bitcoincore.org/bin/ bitcoin-core-$VERSION /bitcoin-$VERSION.tar.gz | tar -xvz
12
20
13
- WORKDIR /bitcoin
21
+ WORKDIR /bitcoin-$VERSION
14
22
15
23
RUN ./autogen.sh
16
24
RUN ./configure \
@@ -29,19 +37,25 @@ RUN ./configure \
29
37
--without-miniupnpc \
30
38
--with-incompatible-bdb
31
39
RUN make clean
32
- RUN make -j$(nproc)
40
+ RUN make -j$(( $( nproc) + 1 ) )
33
41
34
- FROM ubuntu:20.04
42
+ FROM debian:stable-slim
35
43
36
44
ENV DEBIAN_FRONTEND=non-interactive
37
45
38
46
RUN useradd -ms /bin/bash bitcoin
39
- USER bitcoin
40
- WORKDIR /home/bitcoin
47
+
48
+ # Switch to root user
49
+ USER root
41
50
42
51
# Only install what we need at runtime
43
52
RUN apt-get update && apt-get install -y \
44
- libminiupnpc-dev libnatpmp-dev libevent-dev libzmq3-dev libsqlite3-dev
53
+ libminiupnpc-dev libnatpmp-dev libevent-dev libzmq3-dev libsqlite3-dev
54
+
55
+ # Switch back to bitcoin user
56
+ USER bitcoin
57
+
58
+ WORKDIR /home/bitcoin
45
59
46
60
COPY --from=builder /bitcoin/src/bitcoind /usr/local/bin/
47
61
COPY --from=builder /bitcoin/src/bitcoin-cli /usr/local/bin/
0 commit comments