-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.neo-node-with-plugins
61 lines (48 loc) · 1.92 KB
/
Dockerfile.neo-node-with-plugins
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
# Build the plugins
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS PluginBuild
COPY ./neo /neo
WORKDIR /neo
# If any plugin should be excluded from the build, just set
# to a regex including the names of dirs.
# Example:
# REGEX_EXCLUDE_PLUGINS=".*(SystemLog|RpcNep5Tracker)"
ARG REGEX_EXCLUDE_PLUGINS=".*(SystemLog|RpcNep5Tracker)"
# Target framework for the plugins
# ATTENTION: if dotnet version changes, this should be updated!
ENV TARGET_FRAMEWORK="net8.0"
#
# Some magic here. Time for the kids to leave. Adults only.
#
# The following disgusting shell command is due to the lack of tooling
# to exclude tests and specific sub-projects in dotnet. *facepalm*
#
# The good side: main artifacts and tests are not mixed up in the
# same plugins directory, avoiding potential conflicts of .dll versions
# and other nasty problems. *smile*
#
RUN mkdir -p /plugins && \
find ./src/Plugins \
-regextype posix-extended \
-maxdepth 1 \
-mindepth 1 \
-type d \
-and -not -name '.*' \
-and -not -regex "${REGEX_EXCLUDE_PLUGINS}" -print0 \
| xargs -0 -L1 sh -c 'basename $0' \
| sed 's/ //g' \
| xargs -I {} sh -c 'echo Building {} && dotnet publish ./src/Plugins/{} -f $TARGET_FRAMEWORK -c Release /p:ErrorOnDuplicatePublishOutputFiles=false -o /plugins && mkdir -p /plugins/{} && mv /plugins/{}.* /plugins/{}/'
# Build the Neo.CLI
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS NeoCliBuild
COPY ./neo /neo
WORKDIR /neo
RUN dotnet restore && dotnet publish ./src/Neo.CLI -c Release -o /cli
# Final image: neo-node-with-plugins :-)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS NeoCliFinal
LABEL org.opencontainers.image.source https://github.com/axlabs/neo3-privatenet-docker
RUN apt-get -y update && \
apt-get -y install jq nano procps screen libleveldb-dev sqlite3 expect && \
rm -rf /var/lib/apt/lists/*
WORKDIR /neo-cli
COPY --from=NeoCliBuild /cli .
COPY --from=PluginBuild /plugins ./Plugins
ENTRYPOINT ["screen","-DmS","node","dotnet","neo-cli.dll"]