Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (49 loc) · 2.01 KB
/
Copy pathDockerfile
File metadata and controls
70 lines (49 loc) · 2.01 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
FROM debian:bookworm-slim AS builder
RUN apt-get update -y \
&& apt-get install -y ca-certificates curl git gnupg gosu python3 wget build-essential cmake pkg-config libevent-dev libboost-dev libsqlite3-dev libzmq3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /src
# Copy source files
COPY . .
# Remove any existing build directory
RUN rm -rf build/
# Run CMake to configure the build
RUN cmake -S . -B build \
-DWITH_ZMQ=ON \
-DENABLE_IPC=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_UTIL:BOOL=OFF \
-DBUILD_TX:BOOL=OFF \
-DBUILD_WALLET_TOOL=OFF
# Build the project. JOBS caps parallelism when building next to a live
# node whose dbcache already owns most of the RAM.
ARG JOBS
RUN cmake --build build -j"${JOBS:-$(nproc)}"
# Second stage
FROM debian:bookworm-slim
ARG UID=101
ARG GID=101
ARG TARGETPLATFORM
ENV BITCOIN_DATA=/home/bitcoin/.bitcoin
ENV PATH=/opt/bitcoin/bin:$PATH
RUN groupadd --gid ${GID} bitcoin \
&& useradd --create-home --no-log-init -u ${UID} -g ${GID} bitcoin \
&& apt-get update -y \
&& apt-get --no-install-recommends -y install jq curl gnupg gosu ca-certificates pkg-config libevent-dev libboost-dev libsqlite3-dev libzmq3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=builder /src/build/bin/bitcoind /opt/bitcoin/bin/bitcoind
COPY --from=builder /src/build/bin/bitcoin-cli /opt/bitcoin/bin/bitcoin-cli
COPY --chmod=755 entrypoint.sh /entrypoint.sh
VOLUME ["/home/bitcoin/.bitcoin"]
# P2P network (mainnet, testnet & regnet respectively)
EXPOSE 8533 18533 18644
# RPC interface (mainnet, testnet & regnet respectively)
EXPOSE 8532 18532 18643
# ZMQ ports (for transactions & blocks respectively)
EXPOSE 28332 28333
HEALTHCHECK --interval=300s --start-period=60s --start-interval=10s --timeout=20s CMD gosu bitcoin bitcoin-cli -datadir="$BITCOIN_DATA" -rpcwait -getinfo || exit 1
ENTRYPOINT ["/entrypoint.sh"]
RUN bitcoind -version | grep "eCash.*daemon version"
CMD ["bitcoind"]