diff --git a/dockerfiles/dotnet-6.0.Dockerfile b/dockerfiles/dotnet-6.0.Dockerfile index e4ec3ed9..bb9b4362 100644 --- a/dockerfiles/dotnet-6.0.Dockerfile +++ b/dockerfiles/dotnet-6.0.Dockerfile @@ -4,15 +4,18 @@ COPY codecrafters-redis.csproj /app/codecrafters-redis.csproj COPY codecrafters-redis.sln /app/codecrafters-redis.sln RUN mkdir /app/src -RUN echo 'System.Console.WriteLine("Hello World 2!");' > /app/src/Program.cs +RUN (echo 'System.Console.WriteLine("If you are seeing this, there is something wrong with our caching mechanism! Please contact us at hello@codecrafters.io.");' > /app/src/Program.cs) > /dev/null WORKDIR /app -RUN dotnet run --project . --configuration Release "$@" # This saves nuget packages to ~/.nuget +# This saves nuget packages to ~/.nuget +RUN dotnet build --configuration Release . -RUN mkdir /app-cached -RUN mv /app/obj /app-cached/obj -RUN mv /app/bin /app-cached/bin +RUN rm /app/src/Program.cs + +# This seems to cause a caching issue with the dotnet build command, where contents from the removed /src/Program.cs are used +RUN rm -rf /app/obj +RUN rm -rf /app/bin RUN echo "cd \${CODECRAFTERS_SUBMISSION_DIR} && dotnet build --configuration Release ." > /codecrafters-precompile.sh RUN chmod +x /codecrafters-precompile.sh