This repo is now only passively maintained with automation. Upgrade to containers.dotnet10.
Creates a devcontainer with dotnet8 preinstalled.
Published container is available from: https://hub.docker.com/repository/docker/spritelydev/dotnet8-devcontainer
- Copy the src directory into your repository under the .devcontainer folder.
- Rename container-compose.template to container-compose.yaml and edit the file to replace {repo-name} with the name of the repo.
- Edit the devcontainer.json file and replace {repo-name} with the name of the repo.
Run the prepare-for-test.sh script as follows. Create or modify the test/{container-name}/.devcontainer/.env file as needed. Then open the new folder in Visual Studio Code and reopen the folder inside the devcontainer to validate it.
chmod +x prepare-for-test.sh# prepare-for-test.sh {container-name} {true|false - default is false if not supplied}
# code test/{container-name}
# if second argument is true then prepare-for-test also runs this line:
# cp test/{container-name}/.devcontainer/.env.example test/{container-name}/.devcontainer/.env
# Example:
./prepare-for-test.sh dotnet8 true
code test/dotnet8When Visual Studio Code starts select the "Reopen in Container" option. Check that it works. It is often necessary to examine the devcontainer installation logs if something doesn't work as expected.
Some containers will fail to start because they are designed to run as root user.
This is especially problematic when using a rootless environment such as with podman.
For example: microsoft/vscode-remote-release#1685
For additional details on this problem, see: https://code.visualstudio.com/remote/advancedcontainers/add-nonroot-user
Fortunately, there is a simple solution: use a compose file. So that pattern is applied here.