node-util/Dockerfile

54 lines
1.8 KiB
Text
Raw Permalink Normal View History

# Build-only: compiles the C++ cryptonote native addon (lethean-util)
# Requires the Lethean blockchain source tree mounted/copied alongside.
#
# Build context must be the parent directory (zano-upstream/), e.g.:
# docker build -f zano-node-util/Dockerfile -t lethean-util .
#
# The blockchain repo is expected at ./blockchain (symlinked as Lethean inside the package).
FROM node:22 AS builder
# Native build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3 \
python3-pip \
libboost-system-dev \
libboost-date-time-dev \
libboost-thread-dev \
libboost-serialization-dev \
libboost-iostreams-dev \
libboost-locale-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy blockchain source (provides Lethean/ headers referenced by binding.gyp)
COPY blockchain/ ./blockchain/
# Copy the generated currency config header into the build path that binding.gyp expects
RUN mkdir -p blockchain/build/release/src/config
COPY blockchain/build/release/src/config/currency_config.h \
blockchain/build/release/src/config/currency_config.h
# Copy the addon source
COPY zano-node-util/package.json zano-node-util/package-lock.json ./zano-node-util/
COPY zano-node-util/binding.gyp zano-node-util/main.cc zano-node-util/index.js ./zano-node-util/
# Symlink Lethean -> ../blockchain so binding.gyp paths resolve
RUN ln -sf /workspace/blockchain /workspace/zano-node-util/Lethean
WORKDIR /workspace/zano-node-util
RUN npm ci
RUN npm rebuild --build-from-source
# Minimal runtime image with the compiled .node addon
FROM node:22-slim
WORKDIR /app
COPY --from=builder /workspace/zano-node-util/build ./build
COPY --from=builder /workspace/zano-node-util/index.js ./
COPY --from=builder /workspace/zano-node-util/package.json ./