# Cross-platform build for Lethean blockchain binaries # Produces Linux x86_64 and ARM64 binaries # macOS and Windows need native build environments or cross-compilation toolchains # # Usage: # docker build -f Dockerfile.cross-build --target linux-x64 -o ./out . # docker build -f Dockerfile.cross-build --target linux-arm64 -o ./out . # === Base builder === FROM ubuntu:24.04 AS base-builder ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ build-essential cmake git python3 python3-pip \ libboost-all-dev libssl-dev pkg-config curl \ && pip3 install conan --break-system-packages \ && rm -rf /var/lib/apt/lists/* WORKDIR /build COPY . /build/ # === Linux x86_64 === FROM base-builder AS linux-x64-build ARG TESTNET=1 RUN make build CPU_CORES=$(nproc) TESTNET=${TESTNET} STATIC=1 || \ (cd build/release && cmake --build . --parallel $(nproc)) FROM scratch AS linux-x64 COPY --from=linux-x64-build /build/build/release/src/lethean-* / # === Linux ARM64 (cross-compile) === FROM base-builder AS linux-arm64-build RUN apt-get update && apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu ARG TESTNET=1 # ARM64 cross-compilation requires CMAKE_TOOLCHAIN_FILE # This is a placeholder — actual cross-compile needs Conan profile for aarch64 RUN echo "ARM64 cross-compilation requires additional setup. Use native ARM64 builder or QEMU." FROM scratch AS linux-arm64 # Placeholder — use buildx with --platform=linux/arm64 for native ARM builds