|
| 1 | +# SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited |
| 2 | +# SPDX-License-Identifier: LGPL-3.0-only |
| 3 | + |
| 4 | +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.100-noble AS build |
| 5 | + |
| 6 | +ARG BUILD_CONFIG=Release |
| 7 | +ARG BUILD_TIMESTAMP |
| 8 | +ARG CI |
| 9 | +ARG COMMIT_HASH |
| 10 | +ARG TARGETARCH |
| 11 | + |
| 12 | +WORKDIR /src |
| 13 | + |
| 14 | +# Copy source files |
| 15 | +COPY src/Nethermind src/Nethermind |
| 16 | +COPY src/Nethermind.Arbitrum src/Nethermind.Arbitrum |
| 17 | +COPY src/Directory.Build.props . |
| 18 | +COPY src/nuget.config . |
| 19 | + |
| 20 | +# Resolve .NET RID architecture from Docker TARGETARCH |
| 21 | +RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \ |
| 22 | + echo "$arch" > /tmp/dotnet-arch |
| 23 | + |
| 24 | +# Install JetBrains dotMemory (architecture-specific) |
| 25 | +RUN arch=$(cat /tmp/dotnet-arch) && \ |
| 26 | + dotnet add src/Nethermind/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj \ |
| 27 | + package JetBrains.dotMemory.Console.linux-$arch --package-directory /tmp/packages |
| 28 | + |
| 29 | +# Build Arbitrum plugin |
| 30 | +RUN arch=$(cat /tmp/dotnet-arch) && \ |
| 31 | + dotnet publish src/Nethermind.Arbitrum/Nethermind.Arbitrum.csproj -c $BUILD_CONFIG -a $arch -o /arbitrum-plugin --sc false \ |
| 32 | + -p:BuildTimestamp=$BUILD_TIMESTAMP -p:Commit=$COMMIT_HASH -p:DeterministicSourcePaths=false |
| 33 | + |
| 34 | +# Build main Nethermind Runner |
| 35 | +RUN arch=$(cat /tmp/dotnet-arch) && \ |
| 36 | + dotnet publish src/Nethermind/src/Nethermind/Nethermind.Runner/Nethermind.Runner.csproj -c $BUILD_CONFIG -a $arch -o /publish --sc false \ |
| 37 | + -p:BuildTimestamp=$BUILD_TIMESTAMP -p:Commit=$COMMIT_HASH -p:DeterministicSourcePaths=false |
| 38 | + |
| 39 | +# Copy Arbitrum plugin to plugins directory |
| 40 | +RUN mkdir -p /publish/plugins && \ |
| 41 | + cp /arbitrum-plugin/Nethermind.Arbitrum.* /publish/plugins/ |
| 42 | + |
| 43 | +# Copy Stylus native libraries to maintain relative structure from plugin assembly |
| 44 | +RUN mkdir -p /publish/plugins/Arbos/Stylus && \ |
| 45 | + cp -r /arbitrum-plugin/Arbos/Stylus/runtimes /publish/plugins/Arbos/Stylus/ && \ |
| 46 | + echo "Stylus libraries copied:" && \ |
| 47 | + find /publish/plugins/Arbos/Stylus -name "*.so" -o -name "*.dylib" -o -name "*.dll" | sort |
| 48 | + |
| 49 | +# Copy configuration files |
| 50 | +COPY src/Nethermind.Arbitrum/Properties/configs /publish/configs |
| 51 | +COPY src/Nethermind.Arbitrum/Properties/chainspec /publish/chainspec |
| 52 | + |
| 53 | +# Create data directory |
| 54 | +RUN mkdir -p /publish/data |
| 55 | + |
| 56 | +# Install diagnostic tools |
| 57 | +RUN dotnet tool install -g dotnet-dump && \ |
| 58 | + dotnet tool install -g dotnet-gcdump && \ |
| 59 | + dotnet tool install -g dotnet-trace && \ |
| 60 | + dotnet tool install -g JetBrains.dotTrace.GlobalTools |
| 61 | + |
| 62 | +FROM mcr.microsoft.com/dotnet/aspnet:10.0.0-noble |
| 63 | + |
| 64 | +# Fix CVE-2025-68973 - Update gpgv package |
| 65 | +RUN apt-get update && \ |
| 66 | + apt-get install -y --no-install-recommends gpgv=2.4.4-2ubuntu17.4 && \ |
| 67 | + apt-get clean && \ |
| 68 | + rm -rf /var/lib/apt/lists/* |
| 69 | + |
| 70 | +WORKDIR /nethermind |
| 71 | + |
| 72 | +VOLUME /nethermind/diag |
| 73 | +VOLUME /nethermind/keystore |
| 74 | +VOLUME /nethermind/logs |
| 75 | +VOLUME /nethermind/nethermind_db |
| 76 | + |
| 77 | +# Expose ports for JSON-RPC, Engine API, and metrics |
| 78 | +EXPOSE 8545 8551 6060 |
| 79 | + |
| 80 | +# Copy application from build stage |
| 81 | +COPY --from=build /publish . |
| 82 | + |
| 83 | +# Copy diagnostic tools |
| 84 | +COPY --from=build /root/.dotnet/tools /opt/diag-tools |
| 85 | +COPY --from=build /tmp/packages/jetbrains.dotmemory.console.*/**/tools /opt/diag-tools/dotmemory |
| 86 | + |
| 87 | +# Copy diagnostic entrypoint script |
| 88 | +COPY --chmod=0755 scripts/diag-entrypoint.sh entrypoint.sh |
| 89 | + |
| 90 | +ENV PATH="$PATH:/opt/diag-tools:/opt/diag-tools/dotmemory" |
| 91 | + |
| 92 | +STOPSIGNAL SIGINT |
| 93 | + |
| 94 | +ENTRYPOINT ["./entrypoint.sh"] |
0 commit comments