1- # ## Build stage ###
2- FROM ubuntu:22.04 AS builder
1+ # ## Build stage (btc core) ###
2+ FROM ubuntu:22.04 AS btc-core- builder
33
44ENV DEBIAN_FRONTEND=noninteractive
55ARG BTC_CORE_TAG=v29.0
6- ARG PEER_EXTRACTOR_REPO=https://github.com/0xB10C/peer-observer.git
7- ARG PEER_EXTRACTOR_BRANCH=master
86
97# Install build dependencies
108RUN apt-get update && apt-get install -y \
@@ -25,10 +23,18 @@ RUN git clone --branch $BTC_CORE_TAG --depth=1 https://github.com/bitcoin/bitcoi
2523RUN cmake -B build -DBUILD_GUI=OFF -DWITH_USDT=ON -DCMAKE_BUILD_TYPE=Debug && \
2624 cmake --build build -j$(nproc)
2725
26+
27+ # ## Build stage (peer-observer) ###
28+ FROM ubuntu:22.04 AS peer-observer-builder
29+
30+ ARG PEER_EXTRACTOR_REPO=https://github.com/0xB10C/peer-observer.git
31+ ARG PEER_EXTRACTOR_BRANCH=master
32+
2833# Install peer-extractor dependencies
2934RUN apt-get update && apt-get install -y \
3035 sudo git curl protobuf-compiler \
3136 clang elfutils libbpf-dev \
37+ cmake pkgconf \
3238 && rm -rf /var/lib/apt/lists/*
3339
3440# Install Rust
@@ -37,7 +43,7 @@ ENV PATH="/root/.cargo/bin:${PATH}"
3743RUN rustup default stable
3844RUN rustup component add rustfmt
3945
40- # Copy the local repository to the container
46+ # Copy repository to the container
4147RUN git clone -b $PEER_EXTRACTOR_BRANCH --single-branch $PEER_EXTRACTOR_REPO /peer-observer
4248
4349# Set working directory to the repository
@@ -80,10 +86,10 @@ RUN useradd -m -s /bin/bash bitcoin \
8086 && chown -R bitcoin:bitcoin /home/bitcoin /shared
8187
8288# Copy everything we need from builder
83- COPY --from=builder /peer-observer/scripts/bitcoin-node-entrypoint.sh /peer-observer/scripts/bitcoin-node-entrypoint.sh
84- COPY --from=builder /peer-observer/scripts/bitcoin-node-healthcheck.sh /peer-observer/scripts/bitcoin-node-healthcheck.sh
85- COPY --from=builder /bitcoin/build/bin/ /shared/
86- COPY --from=builder /peer-observer/target/release/ebpf-extractor /usr/local/bin/ebpf-extractor
89+ COPY --from=peer-observer- builder /peer-observer/scripts/bitcoin-node-entrypoint.sh /peer-observer/scripts/bitcoin-node-entrypoint.sh
90+ COPY --from=peer-observer- builder /peer-observer/scripts/bitcoin-node-healthcheck.sh /peer-observer/scripts/bitcoin-node-healthcheck.sh
91+ COPY --from=peer-observer- builder /peer-observer/target/release/ebpf-extractor /usr/local/bin/ebpf-extractor
92+ COPY --from=btc-core- builder /bitcoin/build/bin/ /shared/
8793
8894# Expose Bitcoin ports (RPC: 8332, P2P: 8333)
8995EXPOSE 8332 8333
0 commit comments