From fbd37e4d81451c4e290815ac0e03f65afc7c4530 Mon Sep 17 00:00:00 2001 From: Josh Creek Date: Thu, 13 Oct 2022 12:38:48 +0100 Subject: [PATCH] build(*): Add devcontainer --- AdventOfCode/.devcontainer/Dockerfile | 16 +++++ AdventOfCode/.devcontainer/devcontainer.json | 74 ++++++++++++++++++++ AdventOfCode/.vscode/launch.json | 26 +++++++ AdventOfCode/.vscode/settings.json | 5 ++ AdventOfCode/.vscode/tasks.json | 41 +++++++++++ 5 files changed, 162 insertions(+) create mode 100644 AdventOfCode/.devcontainer/Dockerfile create mode 100644 AdventOfCode/.devcontainer/devcontainer.json create mode 100644 AdventOfCode/.vscode/launch.json create mode 100644 AdventOfCode/.vscode/settings.json create mode 100644 AdventOfCode/.vscode/tasks.json diff --git a/AdventOfCode/.devcontainer/Dockerfile b/AdventOfCode/.devcontainer/Dockerfile new file mode 100644 index 0000000..556404d --- /dev/null +++ b/AdventOfCode/.devcontainer/Dockerfile @@ -0,0 +1,16 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet/.devcontainer/base.Dockerfile + +# [Choice] .NET version: 6.0, 3.1, 6.0-bullseye, 3.1-bullseye, 6.0-focal, 3.1-focal +ARG VARIANT="6.0-bullseye-slim" +FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} + +# [Choice] Node.js version: none, lts/*, 18, 16, 14 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/AdventOfCode/.devcontainer/devcontainer.json b/AdventOfCode/.devcontainer/devcontainer.json new file mode 100644 index 0000000..970088f --- /dev/null +++ b/AdventOfCode/.devcontainer/devcontainer.json @@ -0,0 +1,74 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/dotnet +{ + "name": "C# (.NET)", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0 + // Append -bullseye or -focal to pin to an OS version. + "VARIANT": "6.0-bullseye", + // Options + "NODE_VERSION": "none" + } + }, + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-dotnettools.csharp", + "hbenl.vscode-test-explorer", + "formulahendry.dotnet-test-explorer", + "formulahendry.auto-rename-tag", + "EditorConfig.EditorConfig", + "dbaeumer.vscode-eslint", + "bierner.github-markdown-preview", + "eamodio.gitlens", + "yzhang.markdown-all-in-one", + "bierner.markdown-emoji", + "bierner.markdown-footnotes", + "bierner.markdown-preview-github-styles", + "bierner.markdown-yaml-preamble", + "DavidAnson.vscode-markdownlint", + "PKief.material-icon-theme", + "christian-kohler.path-intellisense", + "esbenp.prettier-vscode" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [5000, 5001], + + // [Optional] To reuse of your local HTTPS dev cert: + // + // 1. Export it locally using this command: + // * Windows PowerShell: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // * macOS/Linux terminal: + // dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere" + // + // 2. Uncomment these 'remoteEnv' lines: + // "remoteEnv": { + // "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere", + // "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx", + // }, + // + // 3. Do one of the following depending on your scenario: + // * When using GitHub Codespaces and/or Remote - Containers: + // 1. Start the container + // 2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer + // 3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https" + // + // * If only using Remote - Containers with a local container, uncomment this line instead: + // "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "dotnet restore", + + // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "root" +} diff --git a/AdventOfCode/.vscode/launch.json b/AdventOfCode/.vscode/launch.json new file mode 100644 index 0000000..57c2745 --- /dev/null +++ b/AdventOfCode/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/DayCreator/bin/Debug/net6.0/DayCreator.dll", + "args": [], + "cwd": "${workspaceFolder}/DayCreator", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach" + } + ] +} \ No newline at end of file diff --git a/AdventOfCode/.vscode/settings.json b/AdventOfCode/.vscode/settings.json new file mode 100644 index 0000000..b4f5f59 --- /dev/null +++ b/AdventOfCode/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "dotnet-test-explorer.testProjectPath": "**/*Tests.csproj", + "omnisharp.enableRoslynAnalyzers": true, + "omnisharp.enableEditorConfigSupport": true +} \ No newline at end of file diff --git a/AdventOfCode/.vscode/tasks.json b/AdventOfCode/.vscode/tasks.json new file mode 100644 index 0000000..f2c827f --- /dev/null +++ b/AdventOfCode/.vscode/tasks.json @@ -0,0 +1,41 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/DayCreator/DayCreator.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/DayCreator/DayCreator.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "--project", + "${workspaceFolder}/DayCreator/DayCreator.csproj" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file