diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..0ba51057d --- /dev/null +++ b/.dockerignore @@ -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 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 9c71dc6b3..47291691e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index 72e494805..378dbcf94 100644 --- a/Dockerfile +++ b/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) diff --git a/Radzen.Blazor.Api/Radzen.Blazor.Api.csproj b/Radzen.Blazor.Api/Radzen.Blazor.Api.csproj index 7b6c596a1..57daa6306 100644 --- a/Radzen.Blazor.Api/Radzen.Blazor.Api.csproj +++ b/Radzen.Blazor.Api/Radzen.Blazor.Api.csproj @@ -6,16 +6,25 @@ - + + - $(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.dll - $(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.xml $(MSBuildThisFileDirectory)..\Radzen.Blazor.Api.Generator\Radzen.Blazor.Api.Generator.csproj $(MSBuildThisFileDirectory)Generated\Pages + + + $(PkgRadzen_Blazor)/lib/net10.0/Radzen.Blazor.dll + $(PkgRadzen_Blazor)/lib/net10.0/Radzen.Blazor.xml + + + $(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.dll + $(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net10.0\Radzen.Blazor.xml + + disable - + @@ -72,7 +72,9 @@ $(MSBuildThisFileDirectory)..\RadzenBlazorDemos.Tools\bin\$(Configuration)\net10.0\ $(LlmsTxtToolDir)RadzenBlazorDemos.Tools.exe $(LlmsTxtToolDir)RadzenBlazorDemos.Tools - $(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net8.0\Radzen.Blazor.xml + + $(PkgRadzen_Blazor)/lib/net10.0/Radzen.Blazor.xml + $(MSBuildThisFileDirectory)..\Radzen.Blazor\bin\$(Configuration)\net8.0\Radzen.Blazor.xml $(MSBuildThisFileDirectory)..\Radzen.Blazor\