Skip to content

Commit b97a9a2

Browse files
committed
Add build.cs script and enable Dockerfile-free container publishing
- Add build.cs using Bullseye + SimpleExec for unified build orchestration - Configure dotnet publish /t:PublishContainer for container builds - Update CI workflows to use build.cs commands - Fix Aspire.Hosting.AppHost version (9.2.0 -> 13.1.0) - Remove Dockerfile, .dockerignore, and astro/build.sh (no longer needed) - Update README with new build commands and project structure
1 parent dc5dc6b commit b97a9a2

11 files changed

Lines changed: 170 additions & 133 deletions

File tree

.dockerignore

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,17 @@ jobs:
1616
build:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
20+
21+
- name: Setup .NET
22+
uses: actions/setup-dotnet@v4
2023
with:
21-
submodules: true
22-
- name: build
23-
run: |
24-
docker build .
24+
dotnet-version: '10.0.x'
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '22'
30+
31+
- name: Build container
32+
run: dotnet build.cs container

.github/workflows/link-checker.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
workflow_dispatch:
55
schedule:
66
- cron: "0 10 * * 0"
7-
#push:
8-
# branches:
9-
# - main
107
pull_request:
118
types: [opened, synchronize, reopened, closed]
129
branches:
@@ -21,22 +18,25 @@ jobs:
2118
issues: write
2219
name: Link Checker Job
2320
steps:
24-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
2525
with:
26-
submodules: true
27-
- name: Setup Node
26+
dotnet-version: '10.0.x'
27+
28+
- name: Setup Node.js
2829
uses: actions/setup-node@v4
2930
with:
30-
node-version: 22
31-
- name: Run build
32-
working-directory: astro
33-
run: |
34-
npm ci
35-
./build.sh
31+
node-version: '22'
32+
33+
- name: Build Astro
34+
run: dotnet build.cs astro-build
35+
3636
- name: Link Checker
3737
uses: lycheeverse/lychee-action@v2
3838
env:
3939
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
4040
with:
41-
args: '--header ''x-origin-verify: ${{ secrets.ORIGIN_VERIFICATION_HEADER_VALUE }}'' --no-progress --max-concurrency 8 --skip-missing --accept 200,429 --exclude-path astro/root/_llms-txt --exclude-path astro/root/llms.txt --exclude-path astro/root/llms-full.txt --exclude-path astro/root/llms-small.txt --exclude-loopback --require-https --exclude sample.duendesoftware.com --exclude "docs.duendesoftware.com/404" --exclude sitemap --exclude "https://github.com/DuendeArchive/IdentityModel.AspNetCore/" --root-dir "$PWD/astro/root" astro/root/**'
41+
args: '--header ''x-origin-verify: ${{ secrets.ORIGIN_VERIFICATION_HEADER_VALUE }}'' --no-progress --max-concurrency 8 --skip-missing --accept 200,429 --exclude-path server/Docs.Web/wwwroot/_llms-txt --exclude-path server/Docs.Web/wwwroot/llms.txt --exclude-path server/Docs.Web/wwwroot/llms-full.txt --exclude-path server/Docs.Web/wwwroot/llms-small.txt --exclude-loopback --require-https --exclude sample.duendesoftware.com --exclude "docs.duendesoftware.com/404" --exclude sitemap --exclude "https://github.com/DuendeArchive/IdentityModel.AspNetCore/" --root-dir "$PWD/server/Docs.Web/wwwroot" server/Docs.Web/wwwroot/**'
4242
fail: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Astro build output
22
astro/dist/
33
astro/root/
4+
server/Docs.Web/wwwroot/
45
# generated types
56
astro/.astro/
67

Dockerfile

Lines changed: 0 additions & 38 deletions
This file was deleted.

README.md

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,73 @@ Welcome to the documentation of all [Duende Software](https://duendesoftware.com
44

55
## Getting Started
66

7-
You will need Node 22+ installed on your operating system and available in the PATH.
7+
You will need the following installed:
8+
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
9+
- Node.js 22+
10+
11+
### Quick Start (Astro only)
812

913
```bash
1014
cd astro
1115
npm install
1216
npm run dev
1317
```
1418

15-
Alternatively in VS Code, GitHub Codespaces, or WebStorm, you can use the devcontainer to get a development environment set up.
16-
17-
## Development with .NET Aspire
18-
19-
For local development with the full stack (Astro dev server + ASP.NET Core), you can use .NET Aspire:
19+
### Development with .NET Aspire
2020

21-
### Prerequisites
22-
23-
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
24-
- Node.js 22+
25-
26-
### Running with Aspire
21+
For local development with the full stack (Astro dev server + ASP.NET Core):
2722

2823
```bash
29-
cd server
30-
dotnet run --project Docs.AppHost
24+
dotnet build.cs aspire
3125
```
3226

3327
This starts:
34-
3528
- **Astro dev server** at http://localhost:4321 (with hot reload)
3629
- **ASP.NET Core server** (for production-like static file serving)
3730
- **Aspire Dashboard** at https://localhost:17001 (for traces, logs, metrics)
3831

39-
## Docker
32+
Alternatively in VS Code, GitHub Codespaces, or WebStorm, you can use the devcontainer to get a development environment set up.
4033

41-
### Building the Docker image
34+
## Build Commands
4235

43-
```bash
44-
docker build -t docs-duende .
45-
```
36+
All commands use the `build.cs` file-based build script and can be run from any directory in the repository:
37+
38+
| Command | Action |
39+
| :------ | :----- |
40+
| `dotnet build.cs` | Build everything (Astro + .NET) |
41+
| `dotnet build.cs astro-build` | Build Astro to wwwroot |
42+
| `dotnet build.cs dotnet-build` | Build .NET solution |
43+
| `dotnet build.cs container` | Build container image |
44+
| `dotnet build.cs aspire` | Start Aspire dev environment |
45+
| `dotnet build.cs clean` | Clean all build outputs |
46+
| `dotnet build.cs verify-formatting` | Check .NET code formatting |
47+
| `dotnet build.cs --list-targets` | List all available targets |
48+
49+
## Container
50+
51+
The container is built using `dotnet publish /t:PublishContainer` (no Dockerfile required).
4652

47-
### Running the Docker container
53+
### Building the container
4854

4955
```bash
50-
docker run -p 8080:8080 docs-duende
56+
dotnet build.cs container
5157
```
5258

53-
The site will be available at http://localhost:8080.
54-
55-
### Building with version tag
59+
### Running the container
5660

5761
```bash
58-
docker build --build-arg APPLICATION_VERSION=1.0.0 -t docs-duende .
62+
docker run -p 8080:8080 docs
5963
```
6064

65+
The site will be available at http://localhost:8080.
66+
6167
## Project Structure
6268

6369
This project uses Astro + Starlight for the documentation site, served by ASP.NET Core in production.
6470

6571
```
6672
.
73+
├── build.cs # File-based build script
6774
├── astro/ # Astro documentation site
6875
│ ├── public/
6976
│ ├── src/
@@ -76,6 +83,7 @@ This project uses Astro + Starlight for the documentation site, served by ASP.NE
7683
│ └── tsconfig.json
7784
└── server/ # ASP.NET Core server
7885
├── Docs.Web/ # Static file server
86+
│ └── wwwroot/ # Astro build output (gitignored)
7987
├── Docs.AppHost/ # .NET Aspire orchestrator
8088
└── Docs.ServiceDefaults/ # Shared configuration
8189
```
@@ -115,7 +123,7 @@ WebStorm has Grazie as a built-in spell checker and grammar checker, and support
115123
- When linking to external resources, use the full URL using HTTPS.
116124
- You can link to header anchors using the `#` symbol, for example `[multiple authentication methods](/identityserver/ui/federation.md#multiple-authentication-methods-for-users)`.
117125
- Link relevant text. Prefer `learn more about [improving the sign-in experience]` over `click [here] to learn more`.
118-
- Run `npm run linkchecker` to validate all links (note this will ignore links to GitHub because of rate limits in place).
126+
- Run `dotnet build.cs link-check` to build Astro for link validation (actual lychee check runs in CI).
119127
- When a markdown link is long (75+ characters) or a link is repeated multiple times on a page, prefer moving the link to the bottom of the file and using markdown anchor syntax `[test.cs][repo-test-file]`
120128

121129
### Markdown Style
@@ -156,17 +164,15 @@ WebStorm has Grazie as a built-in spell checker and grammar checker, and support
156164
157165
## 🧞 Commands
158166
159-
All commands are run from the `astro/` directory, from a terminal:
160-
161-
| Command | Action |
162-
| :------------------------ | :----------------------------------------------- |
163-
| `npm install` | Installs dependencies |
164-
| `npm run dev` | Starts local dev server at `localhost:4321` |
165-
| `npm run build` | Build your production site to `./root/` |
166-
| `npm run preview` | Preview your build locally, before deploying |
167-
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
168-
| `npm run astro -- --help` | Get help using the Astro CLI |
169-
| `npm run linkchecker` | Run lychee link checker |
167+
Astro commands are run from the `astro/` directory:
168+
169+
| Command | Action |
170+
| :------ | :----- |
171+
| `npm install` | Installs dependencies |
172+
| `npm run dev` | Starts local dev server at `localhost:4321` |
173+
| `npm run build` | Build production site (use `dotnet build.cs astro-build` instead) |
174+
| `npm run preview` | Preview your build locally |
175+
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
170176

171177
## 🔀 Redirects
172178

astro/build.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

astro/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"@fontsource/roboto": "^5.2.9",
3131
"@pasqal-io/starlight-client-mermaid": "^0.1.0",
3232
"@resvg/resvg-js": "^2.6.2",
33+
"@resvg/resvg-js-win32-x64-msvc": "^2.6.2",
34+
"@rollup/rollup-win32-x64-msvc": "^4.55.1",
3335
"astro": "^5.17.1",
3436
"astro-opengraph-images": "^1.14.2",
3537
"astro-redirect-from": "^1.3.4",

build.cs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#:package Bullseye@5.0.0
2+
#:package SimpleExec@12.0.0
3+
4+
using Bullseye;
5+
using static Bullseye.Targets;
6+
using static SimpleExec.Command;
7+
8+
// Find repository root
9+
var repoRoot = Directory.GetCurrentDirectory();
10+
while (!Directory.Exists(Path.Combine(repoRoot, ".git")))
11+
{
12+
repoRoot = Directory.GetParent(repoRoot)?.FullName
13+
?? throw new InvalidOperationException("Could not find repository root");
14+
}
15+
16+
var astroDir = Path.Combine(repoRoot, "astro");
17+
var serverDir = Path.Combine(repoRoot, "server");
18+
var wwwrootDir = Path.Combine(serverDir, "Docs.Web", "wwwroot");
19+
20+
// Target names
21+
const string Restore = "restore";
22+
const string AstroInstall = "astro-install";
23+
const string AstroBuild = "astro-build";
24+
const string DotnetBuild = "dotnet-build";
25+
const string DotnetPublish = "dotnet-publish";
26+
const string Build = "build";
27+
const string Container = "container";
28+
const string Aspire = "aspire";
29+
const string LinkCheck = "link-check";
30+
const string VerifyFormatting = "verify-formatting";
31+
const string Clean = "clean";
32+
const string Default = "default";
33+
34+
// Restore/Install
35+
Target(Restore, () =>
36+
RunAsync("dotnet", "restore Docs.slnx", workingDirectory: serverDir));
37+
38+
// Use 'npm install' instead of 'npm ci' due to npm bug with optional dependencies on Windows
39+
// See: https://github.com/npm/cli/issues/4828
40+
Target(AstroInstall, () =>
41+
RunAsync("npm", "install", workingDirectory: astroDir));
42+
43+
// Build
44+
Target(AstroBuild, dependsOn: [AstroInstall], () =>
45+
RunAsync("npm", "run build -- --outDir ../server/Docs.Web/wwwroot", workingDirectory: astroDir));
46+
47+
Target(DotnetBuild, dependsOn: [Restore], () =>
48+
RunAsync("dotnet", "build Docs.slnx --no-restore", workingDirectory: serverDir));
49+
50+
Target(DotnetPublish, dependsOn: [Restore], () =>
51+
RunAsync("dotnet", "publish Docs.Web/Docs.Web.csproj -c Release --no-restore",
52+
workingDirectory: serverDir));
53+
54+
Target(Build, dependsOn: [AstroBuild, DotnetBuild]);
55+
56+
// Container (no Dockerfile needed!)
57+
Target(Container, dependsOn: [AstroBuild], () =>
58+
RunAsync("dotnet", "publish Docs.Web/Docs.Web.csproj -c Release /t:PublishContainer",
59+
workingDirectory: serverDir));
60+
61+
// Dev
62+
Target(Aspire, () =>
63+
RunAsync("dotnet", "run --project Docs.AppHost", workingDirectory: serverDir));
64+
65+
// Quality - Link check builds Astro; actual lychee runs in CI workflow due to secrets
66+
Target(LinkCheck, dependsOn: [AstroBuild], () =>
67+
Console.WriteLine($"Astro built to {wwwrootDir}. Run lychee manually or via CI workflow."));
68+
69+
Target(VerifyFormatting, dependsOn: [Restore], () =>
70+
RunAsync("dotnet", "format Docs.slnx --verify-no-changes --no-restore",
71+
workingDirectory: serverDir));
72+
73+
// Clean
74+
Target(Clean, async () =>
75+
{
76+
await RunAsync("dotnet", "clean Docs.slnx", workingDirectory: serverDir);
77+
if (Directory.Exists(wwwrootDir))
78+
Directory.Delete(wwwrootDir, recursive: true);
79+
});
80+
81+
Target(Default, dependsOn: [Build]);
82+
83+
await RunTargetsAndExitAsync(args);

0 commit comments

Comments
 (0)