From 5ad0cfee39707853bfb8c34b5abf59deca358b7a Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Fri, 20 Oct 2023 18:46:11 +0100 Subject: [PATCH 1/4] Update dotnet-6.0.Dockerfile --- dockerfiles/dotnet-6.0.Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dockerfiles/dotnet-6.0.Dockerfile b/dockerfiles/dotnet-6.0.Dockerfile index e4ec3ed9..b2fc1dfb 100644 --- a/dockerfiles/dotnet-6.0.Dockerfile +++ b/dockerfiles/dotnet-6.0.Dockerfile @@ -4,15 +4,17 @@ 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 WORKDIR /app RUN dotnet run --project . --configuration Release "$@" # This saves nuget packages to ~/.nuget +RUN rm /app/src/Program.cs -RUN mkdir /app-cached -RUN mv /app/obj /app-cached/obj -RUN mv /app/bin /app-cached/bin +# This seems to cause a caching issue with the dotnet build command, where contents from the removed /src/Program.cs are used +# RUN mkdir /app-cached +# RUN mv /app/obj /app-cached/obj +# RUN mv /app/bin /app-cached/bin RUN echo "cd \${CODECRAFTERS_SUBMISSION_DIR} && dotnet build --configuration Release ." > /codecrafters-precompile.sh RUN chmod +x /codecrafters-precompile.sh From 32c485c0de36423251eabad0dc207adca91169b9 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Fri, 20 Oct 2023 18:59:19 +0100 Subject: [PATCH 2/4] Update dotnet-6.0.Dockerfile --- dockerfiles/dotnet-6.0.Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dockerfiles/dotnet-6.0.Dockerfile b/dockerfiles/dotnet-6.0.Dockerfile index b2fc1dfb..f5071cbf 100644 --- a/dockerfiles/dotnet-6.0.Dockerfile +++ b/dockerfiles/dotnet-6.0.Dockerfile @@ -12,9 +12,8 @@ RUN dotnet run --project . --configuration Release "$@" # This saves nuget packa 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 mkdir /app-cached -# RUN mv /app/obj /app-cached/obj -# RUN mv /app/bin /app-cached/bin +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 From f7e3a736b6648f9c5ecb12f11758dae4b837815b Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Fri, 20 Oct 2023 19:16:07 +0100 Subject: [PATCH 3/4] Update dotnet-6.0.Dockerfile --- dockerfiles/dotnet-6.0.Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dockerfiles/dotnet-6.0.Dockerfile b/dockerfiles/dotnet-6.0.Dockerfile index f5071cbf..2b59be3f 100644 --- a/dockerfiles/dotnet-6.0.Dockerfile +++ b/dockerfiles/dotnet-6.0.Dockerfile @@ -4,11 +4,13 @@ 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("If you are seeing this, there is something wrong with our caching mechanism! Please contact us at hello@codecrafters.io.");' > /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 run --project . --configuration Release "$@" | grep -v "hello@codecrafters.io" + 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 From 4fa8e099ba227b78f16f2f849900665d1286a92b Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Fri, 20 Oct 2023 19:23:18 +0100 Subject: [PATCH 4/4] Update dotnet-6.0.Dockerfile --- dockerfiles/dotnet-6.0.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfiles/dotnet-6.0.Dockerfile b/dockerfiles/dotnet-6.0.Dockerfile index 2b59be3f..bb9b4362 100644 --- a/dockerfiles/dotnet-6.0.Dockerfile +++ b/dockerfiles/dotnet-6.0.Dockerfile @@ -9,7 +9,7 @@ RUN (echo 'System.Console.WriteLine("If you are seeing this, there is something WORKDIR /app # This saves nuget packages to ~/.nuget -RUN dotnet run --project . --configuration Release "$@" | grep -v "hello@codecrafters.io" +RUN dotnet build --configuration Release . RUN rm /app/src/Program.cs