Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
2.2 KiB
Docker
Raw Normal View History

2026-06-12 19:27:16 +04:00
# One image for every podman NAT scenario, built as localhost/storage-nat.
2026-06-15 10:15:59 +04:00
# Carries the storage binary + miniupnpd (for the upnp/pcp routers); scenarios
2026-06-12 19:27:16 +04:00
# differ only in their entrypoint scripts, which compose mounts.
# Build context = project root.
2026-05-20 09:50:13 +04:00
FROM ubuntu:24.04
ARG NIM_VERSION=2.2.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc g++ make cmake git curl ca-certificates xz-utils \
2026-06-15 10:15:59 +04:00
libc-dev ccache pkg-config \
iproute2 iptables nftables jq \
libnftnl-dev libmnl-dev \
2026-05-20 09:50:13 +04:00
&& rm -rf /var/lib/apt/lists/*
2026-06-15 10:15:59 +04:00
# miniupnpd with the real nftables backend (the iptables backend no longer builds
# against modern libiptc), used by the upnp/pcp routers: its mapping requests
# install a genuine DNAT on the router, so AutoNAT's dial-back reaches the node.
2026-05-20 09:50:13 +04:00
RUN git clone --depth=1 --branch miniupnpd_2_3_9 \
2026-06-15 10:15:59 +04:00
https://github.com/miniupnp/miniupnp.git /tmp/miniupnp-nft \
&& cd /tmp/miniupnp-nft/miniupnpd \
&& ./configure --firewall=nftables \
&& make miniupnpd \
&& install -m 755 miniupnpd /usr/local/sbin/miniupnpd-nft \
&& rm -rf /tmp/miniupnp-nft
2026-05-20 09:50:13 +04:00
RUN curl -fsSL "https://nim-lang.org/download/nim-${NIM_VERSION}-linux_x64.tar.xz" \
2026-06-12 19:27:16 +04:00
| tar -xJ -C /opt
RUN ln -s "/opt/nim-${NIM_VERSION}/bin/nim" /usr/local/bin/nim
2026-05-20 09:50:13 +04:00
WORKDIR /app
2026-06-12 19:27:16 +04:00
# vendor/ already has the checked-out submodules, so no `make update` here.
2026-05-20 09:50:13 +04:00
COPY vendor/ vendor/
COPY storage/ storage/
COPY build.nims config.nims storage.nim ./
2026-06-12 19:27:16 +04:00
# libplum static lib, linked by nim-libplum.
2026-05-20 09:50:13 +04:00
RUN --mount=type=cache,target=/root/.ccache \
export PATH="/usr/lib/ccache:$PATH" && \
rm -rf vendor/nim-libplum/vendor/libplum/build && \
cmake -B vendor/nim-libplum/vendor/libplum/build \
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF \
vendor/nim-libplum/vendor/libplum && \
2026-06-12 19:27:16 +04:00
make -j"$(nproc)" -C vendor/nim-libplum/vendor/libplum/build && \
2026-05-20 09:50:13 +04:00
cp vendor/nim-libplum/vendor/libplum/build/libplum.a \
2026-05-25 17:43:39 +04:00
vendor/nim-libplum/vendor/libplum/libplum.a
2026-05-20 09:50:13 +04:00
2026-06-12 19:27:16 +04:00
RUN --mount=type=cache,target=/root/.ccache \
export PATH="/usr/lib/ccache:$PATH" && \
USE_SYSTEM_NIM=1 vendor/nimbus-build-system/scripts/env.sh \
nim storage -d:disable_libbacktrace build.nims