Skip to content

Commit bdae276

Browse files
committed
build: adjust C# Dockerfileis for build from sources
1. Remove Dockerfile.sharp.sources.from_binaries, this way of build is not relevant after all C# modules are moved to a single repo. 2. Rename Dockerfile.sharp.sources.from_local_dependencies to Dockerfile.sharp.sources, it's the only way to build C# node from sources. 3. Adjust sources build algorithm. 4. Adjust the related documentation. Close #148. A part of #175. Signed-off-by: Anna Shaleva <[email protected]>
1 parent e273abc commit bdae276

11 files changed

+106
-303
lines changed
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS Build
2+
3+
# Install system dependencies.
4+
RUN set -x \
5+
&& apt-get update \
6+
&& apt-get install -y \
7+
unzip \
8+
wget
9+
10+
# Publish neo-cli from source as a self-contained deployment into /neo-cli folder (all dependant .dlls are included).
11+
# See https://docs.microsoft.com/ru-ru/dotnet/core/deploying/#publish-self-contained for details.
12+
ENV REVISION="b204fd1b8f8c578fb92d4997458680b988848722"
13+
RUN wget -O /tmp/neo-cli.zip https://github.com/neo-project/neo/archive/${REVISION}.zip && \
14+
unzip -q -d /tmp/neo-node/ /tmp/neo-cli.zip && \
15+
dotnet publish -c Release --framework net9.0 -o /neo-cli /tmp/neo-node/*/src/Neo.CLI && \
16+
mkdir /neo-cli/Plugins
17+
18+
# Publish required neo-modules and move them into corresponding neo-cli/Plugins folder.
19+
ENV MODULES="LevelDBStore DBFTPlugin RpcServer"
20+
# StateService StorageDumper ApplicationLogs
21+
RUN for mod in ${MODULES}; do \
22+
dotnet publish -c Release --framework net9.0 /tmp/neo-node/*/src/Plugins/${mod}/; \
23+
mkdir /neo-cli/Plugins/${mod}; \
24+
mv /tmp/neo-node/*/bin/Neo.Plugins.${mod}/net9.0/${mod}.dll /neo-cli/Plugins/${mod}/; \
25+
done
26+
27+
# All things are published, so build the final image by copying binaries from Build
28+
FROM mcr.microsoft.com/dotnet/aspnet:9.0 as Final
29+
30+
# Frontend non-interactive
31+
ENV DEBIAN_FRONTEND noninteractive
32+
33+
# Disable dotnet usage information collection
34+
# https://docs.microsoft.com/en-us/dotnet/core/tools/telemetry#behavior
35+
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
36+
37+
# Install system dependencies. always should be done in one line
38+
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#run
39+
RUN set -x \
40+
&& apt-get update \
41+
&& apt-get install -y \
42+
libleveldb-dev \
43+
curl \
44+
jq \
45+
libssl-dev \
46+
libunwind8 \
47+
librocksdb-dev \
48+
libc6-dev \
49+
iproute2 \
50+
# APT cleanup to reduce image size
51+
&& rm -rf /var/lib/apt/lists/*
52+
53+
# Copy neo-cli and all dependant .dlls from Build
54+
COPY --from=Build /neo-cli /neo-cli/
55+
56+
WORKDIR /neo-cli
57+
58+
RUN chmod +x /neo-cli/neo-cli
59+
60+
COPY ./sharp.entrypoint.sh /entrypoint.sh
61+
COPY ./sharp.healthcheck.sh /healthcheck.sh
62+
COPY ./sharp.rpc.config.json /neo-cli/Plugins/RpcServer/RpcServer.json
63+
COPY ./sharp.dbft.config.json /neo-cli/Plugins/DBFTPlugin/DBFTPlugin.json
64+
#COPY ./sharp.stateservice.config.json /neo-cli/Plugins/StateService/StateService.json
65+
#COPY ./sharp.storagedumper.config.json /neo-cli/Plugins/StorageDumper/StorageDumper.json
66+
#COPY ./sharp.applicationlogs.config.json /neo-cli/Plugins/ApplicationLogs/ApplicationLogs.json
67+
68+
ENTRYPOINT [ "/entrypoint.sh" ]

.docker/build/Dockerfile.sharp.sources.from_binaries

-122
This file was deleted.

.docker/build/Dockerfile.sharp.sources.from_local_dependencies

-106
This file was deleted.

.docker/build/sharp.dbft.config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"AutoStart": true,
66
"Network": 56753,
77
"MaxBlockSize": 16777216,
8-
"MaxBlockSystemFee": 1600000000000
8+
"MaxBlockSystemFee": 1600000000000,
9+
"UnhandledExceptionPolicy": "StopNode"
910
}
1011
}

.docker/build/sharp.healthcheck.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
maxDelayBlocks=10
44
# shellcheck disable=SC2155
5-
export port=$(jq -r '.PluginConfiguration.Servers[0].Port' </neo-cli/Plugins/RpcServer/config.json)
5+
export port=$(jq -r '.PluginConfiguration.Servers[0].Port' </neo-cli/Plugins/RpcServer/RpcServer.json)
66
export host=127.0.0.1
77
export addr=${host}:${port}
88
echo curl -s -X POST "http://$addr" -H 'Content-Type: application/json' -d '{ "jsonrpc": "2.0", "id": 5, "method": "getblockcount", "params": [] }'

.docker/build/sharp.rpc.config.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"PluginConfiguration": {
3+
"UnhandledExceptionPolicy": "Ignore",
34
"Servers": [
45
{
56
"Network": 56753,

.docker/build/sharp.statesdumper.config.json

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"PluginConfiguration": {
3+
"Path": "Data_MPT_{0}",
4+
"FullState": true,
5+
"Network": 56753,
6+
"AutoVerify": false,
7+
"MaxFindResultItems": 100,
8+
"UnhandledExceptionPolicy": "StopPlugin"
9+
},
10+
"Dependency": [
11+
"RpcServer"
12+
]
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"PluginConfiguration": {
3+
"BlockCacheSize": 1000,
4+
"HeightToBegin": 0,
5+
"StoragePerFolder": 100000,
6+
"Exclude": [ -4 ],
7+
"UnhandledExceptionPolicy": "Ignore"
8+
}
9+
}

.env

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,4 @@ DC_MIXED_7_IR=.docker/ir/docker-compose.mixed.7.yml
1919
DF_GO=.docker/build/Dockerfile.golang
2020
DF_BENCH=.docker/build/Dockerfile.bench
2121
DF_SHARP=.docker/build/Dockerfile.sharp
22-
#DF_SHARP=.docker/build/Dockerfile.sharp.sources.from_binaries
23-
#DF_SHARP=.docker/build/Dockerfile.sharp.sources.from_local_dependencies
22+
#DF_SHARP=.docker/build/Dockerfile.sharp.sources

0 commit comments

Comments
 (0)