-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (58 loc) · 1.69 KB
/
Dockerfile
File metadata and controls
70 lines (58 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Stage 1: Build bitcoin core
FROM debian:bookworm-slim AS builder
ARG BITCOIN_VERSION=v29.0
RUN apt-get update && apt-get install -y \
automake \
cmake \
autotools-dev \
build-essential \
git \
libtool \
pkg-config \
python3-minimal \
libboost-system-dev \
libboost-filesystem-dev \
libboost-chrono-dev \
libboost-program-options-dev \
libboost-test-dev \
libboost-thread-dev \
libssl-dev \
libevent-dev \
libdb++-dev \
bsdmainutils \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /bitcoin
RUN git clone https://github.com/bitcoin/bitcoin.git . \
&& git checkout -b ${BITCOIN_VERSION} ${BITCOIN_VERSION} \
&& cmake -B build \
&& cmake --build build -j$(nproc)
# Stage 2: Final image
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
libboost-system1.74.0 \
libboost-filesystem1.74.0 \
libboost-chrono1.74.0 \
libboost-program-options1.74.0 \
libboost-thread1.74.0 \
libssl3 \
libevent-2.1-7 \
libevent-extra-2.1-7 \
libevent-pthreads-2.1-7 \
iproute2 \
iptables \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /bitcoin/build/bin/bitcoind /usr/local/bin/
COPY --from=builder /bitcoin/build/bin/bitcoin-cli /usr/local/bin/
RUN mkdir -p /bitcoin
# Create bitcoin user and group
RUN groupadd -r bitcoin && \
useradd -r -g bitcoin -s /sbin/nologin -c "Bitcoin node user" bitcoin && \
chown -R bitcoin:bitcoin /bitcoin
VOLUME ["/bitcoin"]
WORKDIR /bitcoin
# Expose RPC ports
EXPOSE 8332 8333
USER bitcoin
ENTRYPOINT ["bitcoind", "-datadir=/bitcoin/.bitcoin", "-conf=/bitcoin/bitcoin.conf", "-rpcbind=0.0.0.0", "-daemon=0"]