d-velop / dvelop-app-template-cs

This template contains everything you need to write an app for d.velop cloud in C#
Apache License 2.0
16 stars 7 forks source link

Cache NuGet packages for faster restore #26

Closed hangy closed 5 years ago

hangy commented 5 years ago

I'm not quite sure if the updated .dockerignore is worth it, but manually copying the sln/csproj files to the Docker container seems to be one of the best/fastest ways to cache NuGet packages for a Docker build. The main reason is that it drastically reduces the amount of files that need to be checked. Unfortunately, it also adds several intermediary images and needs to be modified for every added/removed csproj.

A better solution might be to tar/zip the project files, but it's a bit more complicated to implement cross-platform in build-docker.bat.

If merged, this fixes #21

ckuetbach commented 5 years ago

I think this is a good aproach to speed up the buildprocess, but I've decided to use a different way, because if you change the csproj file, the container will be rebuild and this will take significant time. This may be worse if you work with many branches, because all branches and apps will need a individual container.

The solution in #28 will also cache different version of the packages and all apps will technically built with the same container, because the Content within the container will the same. If one omits the the APP_NAME from the container all apps will share the same cache volume. This will reduce the needed discspace and buildtime.