mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
Speed up website deploy: generate API docs from the Radzen.Blazor package
The Docker deploy compiled Radzen.Blazor from source (3 target frameworks plus Sass and Terser) only to feed the API reference generator, even though the deployed site ships the published Radzen.Blazor NuGet package. Generate the API docs and llms.txt from that same package and drop the source build. - Radzen.Blazor.Api: reference the Radzen.Blazor package in Release (source project in Debug), like RadzenBlazorDemos already does; the generator reads the package dll/xml. - RadzenBlazorDemos: GenerateLlmsTxt reads the package XML in Release so the LLM docs keep their API descriptions. - Dockerfile: restore for Release, drop the Radzen.Blazor source build, generate API pages from the restored package, set NUGET_XMLDOC_MODE=none so the package XML is extracted. - Add .dockerignore to keep .git/bin/obj out of the build context. - deploy.yml: shallow checkout (fetch-depth 1).
This commit is contained in:
29
.dockerignore
Normal file
29
.dockerignore
Normal file
@@ -0,0 +1,29 @@
|
||||
# Keep the Docker build context small. Without this, `COPY . .` ships the
|
||||
# entire .git history (~115MB) and every bin/obj into the build context,
|
||||
# bloating uploads and invalidating layer caches on every build.
|
||||
|
||||
# Version control
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
|
||||
# .NET build outputs - rebuilt inside the image
|
||||
**/bin/
|
||||
**/obj/
|
||||
**/.vs/
|
||||
*.user
|
||||
|
||||
# Editor / OS cruft
|
||||
.vscode/
|
||||
.idea/
|
||||
.DS_Store
|
||||
|
||||
# Node tooling (if any)
|
||||
**/node_modules/
|
||||
|
||||
# CI config - never needed at build or runtime
|
||||
.github/
|
||||
|
||||
# The Docker build files themselves
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
|
||||
19
Dockerfile
19
Dockerfile
@@ -4,6 +4,10 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# The SDK image sets NUGET_XMLDOC_MODE=skip; the API page generator needs Radzen.Blazor.xml from the
|
||||
# restored package, so re-enable XML doc extraction during restore.
|
||||
ENV NUGET_XMLDOC_MODE=none
|
||||
|
||||
# Copy project files first for better caching
|
||||
COPY Radzen.Blazor/*.csproj Radzen.Blazor/
|
||||
COPY Radzen.Blazor.Api/*.csproj Radzen.Blazor.Api/
|
||||
@@ -12,19 +16,22 @@ COPY RadzenBlazorDemos/*.csproj RadzenBlazorDemos/
|
||||
COPY RadzenBlazorDemos.Host/*.csproj RadzenBlazorDemos.Host/
|
||||
COPY RadzenBlazorDemos.Tools/*.csproj RadzenBlazorDemos.Tools/
|
||||
|
||||
# Restore dependencies (Host + Tools + API page generator)
|
||||
RUN dotnet restore RadzenBlazorDemos.Host/RadzenBlazorDemos.Host.csproj \
|
||||
# Restore for Release so the Radzen.Blazor NuGet package (referenced only in Release) is downloaded
|
||||
# for both the publish below and the API page generator.
|
||||
RUN dotnet restore RadzenBlazorDemos.Host/RadzenBlazorDemos.Host.csproj -p:Configuration=Release \
|
||||
&& dotnet restore RadzenBlazorDemos.Tools/RadzenBlazorDemos.Tools.csproj \
|
||||
&& dotnet restore Radzen.Blazor.Api.Generator/Radzen.Blazor.Api.Generator.csproj
|
||||
|
||||
# Copy full source after restore layer
|
||||
COPY . .
|
||||
|
||||
# Pre-generate API reference pages (must exist on disk before publish evaluates globs)
|
||||
RUN dotnet build Radzen.Blazor/Radzen.Blazor.csproj -c Release \
|
||||
# Pre-generate API reference pages from the published Radzen.Blazor package - the deployed site uses that
|
||||
# same package, so there is no need to compile Radzen.Blazor (and its Sass/JS assets) from source.
|
||||
# Pages must exist on disk before publish evaluates the Api project's Razor globs.
|
||||
RUN RADZEN_DLL=$(find /root/.nuget/packages/radzen.blazor -path '*/lib/net10.0/Radzen.Blazor.dll' | sort -V | tail -1) \
|
||||
&& test -n "$RADZEN_DLL" \
|
||||
&& dotnet run --project Radzen.Blazor.Api.Generator -- \
|
||||
Radzen.Blazor/bin/Release/net10.0/Radzen.Blazor.dll \
|
||||
Radzen.Blazor/bin/Release/net10.0/Radzen.Blazor.xml \
|
||||
"$RADZEN_DLL" "${RADZEN_DLL%.dll}.xml" \
|
||||
Radzen.Blazor.Api/Generated/Pages
|
||||
|
||||
# Publish the Blazor host app (generated pages are now on disk for the SDK to discover)
|
||||
|
||||
@@ -6,16 +6,25 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Radzen.Blazor\Radzen.Blazor.csproj" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="*" GeneratePathProperty="true" Condition="'$(Configuration)' == 'Release'" />
|
||||
<ProjectReference Include="..\Radzen.Blazor\Radzen.Blazor.csproj" Condition="'$(Configuration)' != 'Release'" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<RadzenBlazorDll>$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.dll</RadzenBlazorDll>
|
||||
<RadzenBlazorXml>$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.xml</RadzenBlazorXml>
|
||||
<GeneratorProject>$(MSBuildThisFileDirectory)..\Radzen.Blazor.Api.Generator\Radzen.Blazor.Api.Generator.csproj</GeneratorProject>
|
||||
<GeneratedPagesDir>$(MSBuildThisFileDirectory)Generated\Pages</GeneratedPagesDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Release reflects over the published package (what the site ships); Debug over the source build. -->
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<RadzenBlazorDll>$(PkgRadzen_Blazor)/lib/net10.0/Radzen.Blazor.dll</RadzenBlazorDll>
|
||||
<RadzenBlazorXml>$(PkgRadzen_Blazor)/lib/net10.0/Radzen.Blazor.xml</RadzenBlazorXml>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' != 'Release'">
|
||||
<RadzenBlazorDll>$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.dll</RadzenBlazorDll>
|
||||
<RadzenBlazorXml>$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.xml</RadzenBlazorXml>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Usage: dotnet build -p:GenerateApiPages=true -->
|
||||
<Target Name="GenerateApiPages" BeforeTargets="ResolveProjectStaticWebAssets;AssignTargetPaths"
|
||||
Inputs="$(RadzenBlazorDll)"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Radzen.Blazor" Version="*" Condition="'$(Configuration)' == 'Release'" />
|
||||
<PackageReference Include="Radzen.Blazor" Version="*" GeneratePathProperty="true" Condition="'$(Configuration)' == 'Release'" />
|
||||
<ProjectReference Include="..\Radzen.Blazor\Radzen.Blazor.csproj" Condition="'$(Configuration)' != 'Release'" />
|
||||
<ProjectReference Include="..\Radzen.Blazor.Api\Radzen.Blazor.Api.csproj" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.*-*" />
|
||||
@@ -72,7 +72,9 @@
|
||||
<LlmsTxtToolDir>$(MSBuildThisFileDirectory)..\RadzenBlazorDemos.Tools\bin\$(Configuration)\net10.0\</LlmsTxtToolDir>
|
||||
<LlmsTxtToolExe Condition="'$(OS)' == 'Windows_NT'">$(LlmsTxtToolDir)RadzenBlazorDemos.Tools.exe</LlmsTxtToolExe>
|
||||
<LlmsTxtToolExe Condition="'$(OS)' != 'Windows_NT'">$(LlmsTxtToolDir)RadzenBlazorDemos.Tools</LlmsTxtToolExe>
|
||||
<RadzenBlazorXmlDoc>$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net8.0\Radzen.Blazor.xml</RadzenBlazorXmlDoc>
|
||||
<!-- Release builds use the published package (no source build); reflect over its XML doc. -->
|
||||
<RadzenBlazorXmlDoc Condition="'$(Configuration)' == 'Release'">$(PkgRadzen_Blazor)/lib/net10.0/Radzen.Blazor.xml</RadzenBlazorXmlDoc>
|
||||
<RadzenBlazorXmlDoc Condition="'$(Configuration)' != 'Release'">$(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net8.0\Radzen.Blazor.xml</RadzenBlazorXmlDoc>
|
||||
<RadzenBlazorSourceDir>$(MSBuildThisFileDirectory)..\Radzen.Blazor\</RadzenBlazorSourceDir>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user