devcontainers / templates

Repository for Dev Container Templates that are managed by Dev Container spec maintainers. See https://github.com/devcontainers/template-starter to create your own!
https://containers.dev/templates
MIT License
1.02k stars 262 forks source link

dotnet template should include a volume mount for nuget package caching #225

Open carlin-q-scott opened 11 months ago

carlin-q-scott commented 11 months ago

Each time the container starts, all nuget packages need to be restored. The package and http caches should be persisted in volume mounts.

    "mounts": [
        "source=NuGetLocal,target=/home/vscode/.local,type=volume",
        "source=NuGet,target=/home/vscode/.nuget,type=volume"
    ],
        "postCreateCommand": "chown vscode /home/vscode/.nuget /home/vscode/.local"

I don't totally understand the rhyme or reason for these two folders used by NuGet. They both contain configuration and caches, but of different kinds.

I also don't fully grasp how the mount system is supposed to work because the mounted volumes are owned by root instead of vscode by default, so I have to run chown as a postBuild script. At least this is in the documentation.

eljog commented 10 months ago

It appears that your container user is a non-root user that is different from the host user who owns the Nuget directories. That is the reason why the documentation suggests to run the chown command, so that the container user can access the files.

As the documentation suggests:

This second step is not required if you will be running in the container as root.