-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
126 lines (110 loc) · 3.53 KB
/
Dockerfile
File metadata and controls
126 lines (110 loc) · 3.53 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# ============================================================================
# Coordinate Core - Multi-Stage Multi-Platform Build
# Builds native binaries for BOTH amd64 (Intel) AND arm64 (Apple Silicon)
# Expected size: ~100-150MB
# ============================================================================
# ------------------------------------------------------------------------------
# Stage 1: Builder
# ------------------------------------------------------------------------------
FROM debian:bookworm AS builder
ARG DEBIAN_FRONTEND=noninteractive
ARG TARGETPLATFORM
ARG TARGETARCH
# Install build dependencies (including commonly missing ones for Bitcoin Core)
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
pkg-config \
bsdmainutils \
python3 \
# Core crypto/SSL dependencies
libssl-dev \
# Event handling
libevent-dev \
# Boost libraries
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-thread-dev \
libboost-chrono-dev \
libboost-program-options-dev \
# Database
libsqlite3-dev \
# Networking
libminiupnpc-dev \
libnatpmp-dev \
libzmq3-dev \
# Additional tools that may be needed
git \
autoconf \
automake \
libtool \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Copy source code
COPY . .
# Build with CMake - SEPARATE STEPS for better error visibility
# Step 1: Configure
RUN echo "=== Configuring for ${TARGETPLATFORM} (${TARGETARCH}) ===" && \
cmake -B build \
-DWITH_ZMQ=ON \
-DBUILD_TESTS=OFF \
-DBUILD_BENCH=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VERBOSE_MAKEFILE=ON
# Step 2: Build (this is where failures typically occur)
RUN echo "=== Building ===" && \
cmake --build build -j$(nproc)
# Step 3: Strip binaries (only if they exist)
RUN echo "=== Stripping binaries ===" && \
if [ -f build/bin/bitcoind ]; then \
strip --strip-all build/bin/bitcoind; \
else \
echo "ERROR: bitcoind binary not found!" && exit 1; \
fi && \
if [ -f build/bin/bitcoin-cli ]; then \
strip --strip-all build/bin/bitcoin-cli; \
else \
echo "ERROR: bitcoin-cli binary not found!" && exit 1; \
fi
# Verify binaries exist before proceeding
RUN ls -la build/bin/
# ------------------------------------------------------------------------------
# Stage 2: Runtime (slim)
# ------------------------------------------------------------------------------
FROM debian:bookworm-slim
LABEL maintainer="dev@mara.tech"
LABEL version="0.2"
LABEL description="Coordinate Core - Multi-Platform Runtime Image"
# Install ALL required runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
# libevent - ALL components
libevent-2.1-7 \
libevent-core-2.1-7 \
libevent-extra-2.1-7 \
libevent-openssl-2.1-7 \
libevent-pthreads-2.1-7 \
# Boost libraries
libboost-filesystem1.74.0 \
libboost-thread1.74.0 \
libboost-chrono1.74.0 \
# Database
libsqlite3-0 \
# Networking
libminiupnpc17 \
libnatpmp1 \
libzmq5 \
# SSL/TLS
libssl3 \
# Other common deps
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
WORKDIR /opt/coordinate
# Copy ONLY binaries from builder stage (native for target platform)
COPY --from=builder --chmod=755 /src/build/bin/bitcoind ./bin/
COPY --from=builder --chmod=755 /src/build/bin/bitcoin-cli ./bin/
# Create data directory
RUN mkdir -p /root/.coordinate
ENTRYPOINT ["./bin/bitcoind"]
CMD []