|
| 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" ] |
0 commit comments