diff --git a/src/Nethermind/Nethermind.Runner/Dockerfile b/src/Nethermind/Nethermind.Runner/Dockerfile index 026a7a7c4fb..ced7515b731 100644 --- a/src/Nethermind/Nethermind.Runner/Dockerfile +++ b/src/Nethermind/Nethermind.Runner/Dockerfile @@ -1,26 +1,45 @@ -#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. +# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base + +#USER app -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app VOLUME /data EXPOSE 8545 8551 30303 -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +# This stage is used to build the service project +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release + WORKDIR /src +COPY Directory.*.props . +COPY nuget.config . COPY Nethermind.*/Nethermind.*.csproj Nethermind.*/ RUN dotnet restore Nethermind.Runner/Nethermind.Runner.csproj + COPY . . + WORKDIR /src/Nethermind.Runner -RUN dotnet build Nethermind.Runner.csproj -c release -o /app/build +RUN dotnet build Nethermind.Runner.csproj -c $BUILD_CONFIGURATION -o /app/build + +# This stage is used to publish the service project to be copied to the final stage FROM build AS publish -RUN dotnet publish Nethermind.Runner.csproj -c release -o /app/publish -p:UseAppHost=false +ARG BUILD_CONFIGURATION=Release + +RUN dotnet publish Nethermind.Runner.csproj -c $BUILD_CONFIGURATION -o /app/publish -p:UseAppHost=false +# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) FROM base AS final + WORKDIR /app + COPY --from=publish /app/publish . + ENTRYPOINT ["dotnet", "nethermind.dll"] diff --git a/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json b/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json index 7c43a7b79a7..d58400541f8 100644 --- a/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json +++ b/src/Nethermind/Nethermind.Runner/Properties/launchSettings.json @@ -114,7 +114,7 @@ }, "Docker": { "commandName": "Docker", - "commandLineArgs": "-c holesky --data-dir .data /data --jsonrpc-enginehost 0.0.0.0 --jsonrpc-engineport 8551 --jsonrpc-host 0.0.0.0" + "commandLineArgs": "-c holesky --data-dir /data --jsonrpc-enginehost 0.0.0.0 --jsonrpc-engineport 8551 --jsonrpc-host 0.0.0.0" } } }