-
Notifications
You must be signed in to change notification settings - Fork 25
feat(devcont): #365 mise task runner for dev #366
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
base: CSharpAPI
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| { | ||
| "name": "Redux .NET Dev Container", | ||
| "image": "mcr.microsoft.com/dotnet/sdk:10.0", | ||
| "features": { | ||
| "ghcr.io/devcontainers/features/common-utils:2": { | ||
| "username": "vscode", | ||
| "installZsh": false, | ||
| "upgradePackages": false | ||
| } | ||
| "image": "mcr.microsoft.com/devcontainers/dotnet:10.0", | ||
| "//appPort": "Publishes 27000 to the host via `docker -p`, so it works from a plain terminal (devcontainer CLI), not just VS Code forwarding. The API binds 0.0.0.0 (see the mise `run` task).", | ||
| "appPort": [27000], | ||
| "portsAttributes": { | ||
| "27000": { "label": "Redux API", "onAutoForward": "notify" } | ||
| }, | ||
| "postCreateCommand": "bash .devcontainer/post-create.sh", | ||
| "remoteUser": "vscode", | ||
| "customizations": { | ||
| "vscode": { | ||
| "extensions": [ | ||
| "ms-dotnettools.csharp" | ||
| ] | ||
| "extensions": ["ms-dotnettools.csharp"] | ||
| } | ||
| }, | ||
| "postStartCommand": "if [ \"$(stat -c %U /workspaces/Redux)\" != \"vscode\" ]; then sudo chown -R vscode:vscode /workspaces/Redux; fi", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And this was in there because of line 6. |
||
| "postCreateCommand": "dotnet --list-sdks" | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| #!/usr/bin/env bash | ||
| # Post-create for the Redux devcontainer. | ||
| # | ||
| # The .NET 10 runtime comes from the base image. This script only layers in mise | ||
| # (the unified task runner) and restores NuGet packages so the container is ready | ||
| # to `mise run build|test|run`. See CLAUDE.md "Toolchain layering (DECIDED)". | ||
| set -euo pipefail | ||
|
|
||
| # 1. Install mise if the base image doesn't already provide it. | ||
| if ! command -v mise >/dev/null 2>&1; then | ||
| curl -fsSL https://mise.run | sh | ||
| fi | ||
| MISE="${HOME}/.local/bin/mise" | ||
|
|
||
| # 2. Activate mise for future interactive shells. | ||
| ACTIVATE="eval \"\$(${MISE} activate bash)\"" | ||
| grep -qF "${ACTIVATE}" "${HOME}/.bashrc" 2>/dev/null || echo "${ACTIVATE}" >> "${HOME}/.bashrc" | ||
|
|
||
| # 3. Trust this repo's mise.toml, then warm the NuGet cache via the shared task. | ||
| "${MISE}" trust | ||
| "${MISE}" run restore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # mise — one task vocabulary across the Redux repos (`mise run build|test|run|watch`), | ||
| # so C#, Python, and JS repos share the same commands. | ||
| # | ||
| # There is intentionally NO [tools] section: the .NET 10 runtime is provided by the | ||
| # devcontainer base image, not mise. mise is the task layer only. See CLAUDE.md | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. your claude is showing... |
||
| # "Toolchain layering (DECIDED)". | ||
| # | ||
| # Every task names Redux.slnx explicitly — a bare `dotnet` at the repo root errors | ||
| # MSB1011 because API.csproj and Redux.slnx sit side by side (same reason CI does). | ||
|
|
||
| [tasks.restore] | ||
| description = "Restore NuGet packages" | ||
| run = "dotnet restore Redux.slnx" | ||
|
|
||
| [tasks.build] | ||
| description = "Build the solution (Release)" | ||
| depends = ["restore"] | ||
| run = "dotnet build Redux.slnx --no-restore --configuration Release" | ||
|
|
||
| [tasks.test] | ||
| description = "Run unit tests (restore -> build -> test, matching CI)" | ||
| depends = ["build"] | ||
| run = "dotnet test Redux.slnx --no-restore --no-build --configuration Release" | ||
|
|
||
| [tasks.run] | ||
| description = "Run the API on http://localhost:27000 (Development + Swagger)" | ||
| # Bind via ASPNETCORE_URLS, NOT `--urls`: `dotnet run` treats `--urls` as an unknown | ||
| # run option and exits before the app starts. 0.0.0.0 so the published port is reachable. | ||
| env = { ASPNETCORE_URLS = "http://0.0.0.0:27000" } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is probably fine in a container, but we need to fix the use of 0.0.0.0 outside of containers so that folks aren't opening up dev stuff on their LAN.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is all meant for container usage |
||
| run = "dotnet run --project API.csproj" | ||
|
|
||
| [tasks.watch] | ||
| description = "Run the API with hot reload on :27000" | ||
| env = { ASPNETCORE_URLS = "http://0.0.0.0:27000" } | ||
| run = "dotnet watch --project API.csproj run" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate running stuff as root, even in a container, which is why this was in there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am agnostic on this, we can switch it back.