Skip to content

Commit

Permalink
Merge pull request #101 from codecrafters-io/rohitpaulk-patch-2
Browse files Browse the repository at this point in the history
Update dotnet-6.0.Dockerfile
  • Loading branch information
rohitpaulk authored Oct 20, 2023
2 parents c0a0541 + 4fa8e09 commit 8e6d425
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions dockerfiles/dotnet-6.0.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e6d425

Please sign in to comment.