acraven / microservice-outsidein-tests

Companion repo for Microservices and Outside-in Tests Using C# and Docker Compose blog post
https://medium.com/@acraven/microservices-and-outside-in-tests-using-c-and-docker-compose-22328f47627?source=friends_link&sk=86092d6e7dfc8a3324f57ba24aed9833
6 stars 2 forks source link

COPY . . idiom - confused? #2

Closed jzabroski closed 4 years ago

jzabroski commented 4 years ago

https://github.com/acraven/microservice-outsidein-tests/blob/5f0b08cc359f9dc5402701d22f4c16ef17819e6f/app/Dockerfile#L12

Reading this, I didn't understand what you were achieving by running this. Even after reading the documentation, I still don't get it. Isn't this copying the build context into /app? But you already copied all the data in /app individually.

jzabroski commented 4 years ago

I think I see what you're doing. You're ONLY copying the csproj, and then running restore on that, so that your nuget packages live on a single layer per project. Then you're copying the source code.

Can I ask why you do this idiom? It's not explained in your article, and while I get that your article is about integration testing and not this, it's not a trick I've seen anyone else do.

jzabroski commented 4 years ago

https://andrewlock.net/optimising-asp-net-core-apps-in-docker-avoiding-manually-copying-csproj-files/

https://andrewlock.net/optimising-asp-net-core-apps-in-docker-avoiding-manually-copying-csproj-files-part-2/

This guy has a weird approach, too.

The only other place I can find your idiom is here:

https://www.hanselman.com/blog/BuildingRunningAndTestingNETCoreAndASPNETCore21InDockerOnARaspberryPiARM32.aspx https://stackoverflow.com/a/50698655/1040437