From 727029c5d2b3e019a88f1e7a87239f48d2333ce5 Mon Sep 17 00:00:00 2001 From: Tim Rogers Date: Thu, 19 May 2022 09:48:53 +0100 Subject: [PATCH] Use the official Codespaces template configuration, rather than something homegrown (#2449) * Test commit Hello! * Correct indentation in `.devcontainer` * Change devcontainer name to `Octokit.net` --- .devcontainer/Dockerfile | 22 +++++++++-- .devcontainer/devcontainer.json | 69 ++++++++++++++++++++++++++------- .devcontainer/setup.sh | 3 -- 3 files changed, 74 insertions(+), 20 deletions(-) delete mode 100644 .devcontainer/setup.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index e0709ba7..0deea1ca 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,18 @@ -FROM mcr.microsoft.com/dotnet/sdk:3.1 -WORKDIR /home/ -COPY . . -RUN bash ./setup.sh +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/dotnet/.devcontainer/base.Dockerfile + +# [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.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/*, 16, 14, 12, 10 +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 python3-pip + +RUN pip3 install mkdocs + +# [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 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 56c5b1f4..d05fa855 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,19 +1,62 @@ +// 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.234.0/containers/dotnet { - "name": "Octokit.NET", + "name": "Octokit.net", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0 + // Append -bullseye or -focal to pin to an OS version. + "VARIANT": "3.1", + // Options + "NODE_VERSION": "none" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": {}, + + // Add the IDs of extensions you want installed when the container is created. "extensions": [ - "formulahendry.dotnet-test-explorer", + "ms-dotnettools.csharp", + "formulahendry.dotnet-test-explorer", "eamodio.gitlens", "fernandoescolar.vscode-solution-explorer", - "ms-dotnettools.csharp", - "redhat.vscode-yaml", + "redhat.vscode-yaml" ], - "dockerFile": "Dockerfile", - "containerEnv": { - // Enable detection of running in a container - "DOTNET_RUNNING_IN_CONTAINER": "true", - // Enable correct mode for dotnet watch (only mode supported in a container) - "DOTNET_USE_POLLING_FILE_WATCHER": "true", - // Skip extraction of XML docs - generally not useful within an image/container - helps perfomance - "NUGET_XMLDOC_MODE": "true" + + // 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": "vscode", + "features": { + "python": "latest" + } } -} diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh deleted file mode 100644 index 1c7b6214..00000000 --- a/.devcontainer/setup.sh +++ /dev/null @@ -1,3 +0,0 @@ -apt-get update -apt-get install -y python3 python3-pip -pip3 install mkdocs