-
Notifications
You must be signed in to change notification settings - Fork 682
Expand file tree
/
Copy pathDockerfile.pgo
More file actions
66 lines (53 loc) · 2.41 KB
/
Dockerfile.pgo
File metadata and controls
66 lines (53 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
# SPDX-License-Identifier: LGPL-3.0-only
#
# Builds Nethermind WITHOUT ReadyToRun so the JIT compiles all methods,
# then enables EventPipe to collect profile data for Static PGO.
# The resulting .nettrace file is converted to .mibc offline.
# Also writes edge/block profiling data (.jit) via DOTNET_WritePGOData
# which is trimmed by PgoTrim and consumed at runtime via DOTNET_ReadPGOData.
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0.201-noble@sha256:478b9038d187e5b5c29bfa8173ded5d29e864b5ad06102a12106380ee01e2e49 AS build
ARG BUILD_CONFIG=release
ARG CI=true
ARG COMMIT_HASH
ARG SOURCE_DATE_EPOCH
ARG TARGETARCH
WORKDIR /nethermind
COPY src/Nethermind src/Nethermind
COPY Directory.*.props Directory.Build.targets ./
COPY global.json .
COPY nuget.config .
RUN arch=$([ "$TARGETARCH" = "amd64" ] && echo "x64" || echo "$TARGETARCH") && \
rid="linux-${arch}" && \
cd src/Nethermind/Nethermind.Runner && \
dotnet restore --locked-mode && \
dotnet publish -c $BUILD_CONFIG -r $rid -o /publish --no-self-contained \
-p:PublishReadyToRun=false \
-p:SourceRevisionId=$COMMIT_HASH
# A temporary symlink to support the old executable name
RUN ln -sr /publish/nethermind /publish/Nethermind.Runner
FROM mcr.microsoft.com/dotnet/aspnet:10.0.5-noble@sha256:a04d1c1d2d26119049494057d80ea6cda25bbd8aef7c444a1fc1ef874fd3955b
WORKDIR /nethermind
# Enable EventPipe for PGO data collection
# JIT events with method details for dotnet-pgo tool
# App assemblies are already built without R2R so they will be JIT-compiled.
# Framework R2R is left enabled to avoid extremely slow startup.
# Override runtimeconfig.json settings not suitable for PGO collection
ENV DOTNET_System_Diagnostics_Tracing_EventSource_IsSupported=true
ENV DOTNET_GCLargePages=0
ENV DOTNET_GCRegionRange=0x800000000
ENV DOTNET_EnableEventPipe=1
ENV DOTNET_EventPipeCircularMB=256
ENV DOTNET_EventPipeOutputPath=/nethermind/pgo/nethermind-{pid}.nettrace
ENV DOTNET_EventPipeConfig=Microsoft-Windows-DotNETRuntime:0x1E000080018:4
# Write edge/block profiling data after Tier-1 compilation for branch optimization
ENV DOTNET_TieredPGO=1
ENV DOTNET_WritePGOData=1
ENV DOTNET_PGODataPath=/nethermind/pgo/nethermind.jit
VOLUME /nethermind/keystore
VOLUME /nethermind/logs
VOLUME /nethermind/nethermind_db
VOLUME /nethermind/pgo
EXPOSE 8545 8551 30303
COPY --from=build /publish .
ENTRYPOINT ["./nethermind"]