Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Dockerfile.diag
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ EXPOSE 8545 8551 30303
COPY --from=build /publish .
COPY --from=build /root/.dotnet/tools /opt/diag-tools
COPY --from=build /tmp/jetbrains.dotmemory.console.*/**/tools /opt/diag-tools/dotmemory
COPY --chmod=0755 scripts/diag-entrypoint.sh entrypoint.sh

ENV PATH="$PATH:/opt/diag-tools:/opt/diag-tools/dotmemory"

ENTRYPOINT ["./nethermind"]
STOPSIGNAL SIGINT

ENTRYPOINT ["./entrypoint.sh"]
54 changes: 54 additions & 0 deletions scripts/diag-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2025 Demerzel Solutions Limited
# SPDX-License-Identifier: LGPL-3.0-only

set -eo pipefail

start_dotmemory() {
echo "Starting dotMemory..."

exec dotmemory start \
--save-to-dir=/nethermind/diag/dotmemory \
--service-output \
./nethermind -- "$@"
}

start_dotnet_trace() {
echo "Starting dotnet-trace..."

exec dotnet-trace collect \
-o /nethermind/diag/dotnet.nettrace \
--show-child-io \
-- ./nethermind "$@"
}

start_dottrace() {
echo "Starting dotTrace..."

exec dottrace start \
--framework=netcore \
--profiling-type=timeline \
--propagate-exit-code \
--save-to=/nethermind/diag/dottrace \
--service-output=on \
-- ./nethermind "$@"
}

case "$DIAG_WITH" in
"")
exec ./nethermind "$@"
;;
dotmemory)
start_dotmemory "$@"
;;
dotnet-trace)
start_dotnet_trace "$@"
;;
dottrace)
start_dottrace "$@"
;;
*)
printf '\e[31mUnknown DIAG_WITH value: %q\e[0m\n' "$DIAG_WITH" >&2
exit 2
;;
esac