logos-messaging-nim/Dockerfile
NagyZoltanPeter a7df0d9c56
chore: adjust artifact builds and uploads to contain logosdeliverynode app (#4059)
* feat(nix): add logosdeliverynode build target

Generalize the wakucanary-only binary path in nix/default.nix into an
app-target map so any app binary shares one build/install/rln-bundle
path, and expose a `logosdeliverynode` flake package (with gitVersion
for --version reporting).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ci(github): build logosdeliverynode in release/pre-release/windows workflows

- release-assets.yml: build logosdeliverynode (POSTGRES=1) so it ships in
  the waku-<arch>-<os>.tar.gz release asset.
- pre-release.yml: add logosdeliverynode to the make targets and to the
  nwaku nightly/RC tarball.
- windows-build.yml: build logosdeliverynode.exe and assert it exists.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* ci(jenkins): build & push logosdeliverynode docker image to harbor

Jenkinsfile.release now builds a second image from the dedicated
logosdeliverynode Dockerfile stage and pushes it to
harbor.status.im/wakuorg/logosdelivery:<IMAGE_TAG> alongside the primary
image. Add a logosdeliverynode stage to the root Dockerfile so the image
entrypoint is /usr/bin/logosdeliverynode rather than the generic
/usr/bin/wakunode symlink. Bump the pipeline timeout to 40m to cover the
extra compile.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* Apply suggestions from code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-28 11:20:05 +01:00

109 lines
3.3 KiB
Docker

# BUILD NIM APP ----------------------------------------------------------------
FROM rustlang/rust:nightly-alpine3.19 AS nim-build
ARG NIMFLAGS
ARG MAKE_TARGET=wakunode2
ARG NIM_COMMIT
ARG HEAPTRACK_BUILD=0
ARG POSTGRES=0
# Get build tools and required header files
RUN apk add --no-cache bash git build-base openssl-dev linux-headers curl jq libbsd-dev
WORKDIR /app
COPY . .
# workaround for alpine issue: https://github.com/alpinelinux/docker-alpine/issues/383
RUN apk update && apk upgrade
# Ran separately from 'make' to avoid re-doing
RUN git submodule update --init --recursive
RUN if [ "$HEAPTRACK_BUILD" = "1" ]; then \
git apply --directory=vendor/nimbus-build-system/vendor/Nim docs/tutorial/nim.2.2.4_heaptracker_addon.patch; \
fi
# Slowest build step for the sake of caching layers
RUN make -j$(nproc) deps QUICK_AND_DIRTY_COMPILER=1 ${NIM_COMMIT}
# Build the final node binary
RUN make -j$(nproc) ${NIM_COMMIT} $MAKE_TARGET NIMFLAGS="${NIMFLAGS}" POSTGRES=${POSTGRES}
# PRODUCTION IMAGE -------------------------------------------------------------
FROM alpine:3.18 AS prod
ARG MAKE_TARGET=wakunode2
LABEL maintainer="jakub@status.im"
LABEL source="https://github.com/waku-org/nwaku"
LABEL description="Wakunode: Waku client"
LABEL commit="unknown"
LABEL version="unknown"
# DevP2P, LibP2P, and JSON RPC ports
EXPOSE 30303 60000 8545
# Referenced in the binary
RUN apk add --no-cache libgcc libpq-dev bind-tools libstdc++
# Copy to separate location to accomodate different MAKE_TARGET values
COPY --from=nim-build /app/build/$MAKE_TARGET /usr/local/bin/
# Copy migration scripts for DB upgrades
COPY --from=nim-build /app/migrations/ /app/migrations/
# Symlink the correct wakunode binary
RUN ln -sv /usr/local/bin/$MAKE_TARGET /usr/bin/wakunode
ENTRYPOINT ["/usr/bin/wakunode"]
# By default just show help if called without arguments
CMD ["--help"]
# LOGOS DELIVERY NODE IMAGE ----------------------------------------------------
# Reuses the prod image but exposes the binary under its own name so the image
# identity and entrypoint are logosdeliverynode rather than the generic
# /usr/bin/wakunode symlink. Build with --build-arg MAKE_TARGET=logosdeliverynode.
FROM prod AS logosdeliverynode
LABEL source="https://github.com/logos-messaging/logos-delivery"
LABEL description="Logos Delivery node"
RUN ln -sv /usr/local/bin/logosdeliverynode /usr/bin/logosdeliverynode
ENTRYPOINT ["/usr/bin/logosdeliverynode"]
# DEBUG IMAGE ------------------------------------------------------------------
# Build debug tools: heaptrack
FROM alpine:3.18 AS heaptrack-build
RUN apk update
RUN apk add -- gdb git g++ make cmake zlib-dev boost-dev libunwind-dev
RUN git clone https://github.com/KDE/heaptrack.git /heaptrack
WORKDIR /heaptrack/build
# going to a commit that builds properly. We will revisit this for new releases
RUN git reset --hard f9cc35ebbdde92a292fe3870fe011ad2874da0ca
RUN cmake -DCMAKE_BUILD_TYPE=Release ..
RUN make -j$(nproc)
# Debug image
FROM prod AS debug-with-heaptrack
RUN apk add --no-cache gdb libunwind
# Add heaptrack
COPY --from=heaptrack-build /heaptrack/build/ /heaptrack/build/
ENV LD_LIBRARY_PATH=/heaptrack/build/lib/heaptrack/
RUN ln -s /heaptrack/build/bin/heaptrack /usr/local/bin/heaptrack
ENTRYPOINT ["/heaptrack/build/bin/heaptrack", "/usr/bin/wakunode"]