Skip to content

feat (codespaces) - Added initial support for codespaces. #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion #scripts/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ $ErrorActionPreference = 'Stop'
$webappServerUrl = 'http://localhost:44100'

Write-Host "Opening new window for initial wait" -ForegroundColor White
Start-Process powershell -ArgumentList "-File `"$PSScriptRoot/run/wait.ps1`""

if ($IsWindows) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably don't have to check, we can just require it to be pwsh on Windows as well, or get whatever is the current shell (should be some built-in constant somewhere, or worst case command line[0]).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pwsh is only applicable for PowerShell-Core. The PowerShell that bundles with Windows does not executable pwsh. If we make pwsh here, then we need to make it mandatory for contributors install PowerShell-Core, which I don't think is needed, as things can work with legacy PowerShell as well on windows.

Start-Process PowerShell -ArgumentList "-File `"$PSScriptRoot/run/wait.ps1`""
} else {
Start-Process pwsh -ArgumentList "-File `"$PSScriptRoot/run/wait.ps1`""
}

dotnet tye run --watch
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/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="5.0"
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT}

# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
ARG NODE_VERSION="none"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we do have a node version requirement (for WebApp).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why NODE_VERSION="none" here, need to check. But we do have NPM installed in codespaces. Check screenshot.

image

RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi

COPY --from=mcr.microsoft.com/vscode/devcontainers/dotnet:5.0 /usr/share/dotnet /usr/share/dotnet
38 changes: 38 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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.202.5/containers/dotnet
{
"name": "C# (.NET)",
"runArgs": [
"--init"
],
"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": "lts/*"
}
},
"settings": {
// Loading projects on demand is better for larger codebases
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableImportCompletion": true,
"omnisharp.enableRoslynAnalyzers": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-dotnettools.csharp",
"EditorConfig.EditorConfig",
"editorconfig.editorconfig",
"jcbuisson.vue",
"dbaeumer.vscode-eslint"
],
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"features": {
"powershell": "latest"
}
}
Loading