ci(build): target .NET 10 Alpine with low-memory tuning
Some checks failed
Caddy Manager CI build / docker (push) Failing after 32s
Some checks failed
Caddy Manager CI build / docker (push) Failing after 32s
This commit is contained in:
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-dotnet@v3
|
- uses: actions/setup-dotnet@v3
|
||||||
with:
|
with:
|
||||||
dotnet-version: '9' # SDK Version to use.
|
dotnet-version: '10' # SDK Version to use.
|
||||||
dotnet-quality: 'ga'
|
dotnet-quality: 'ga'
|
||||||
cache: true
|
cache: true
|
||||||
cache-dependency-path: '**/packages.lock.json'
|
cache-dependency-path: '**/packages.lock.json'
|
||||||
@@ -42,6 +42,6 @@ jobs:
|
|||||||
- name: Publish container
|
- name: Publish container
|
||||||
run: |
|
run: |
|
||||||
dotnet publish \
|
dotnet publish \
|
||||||
--configuration Release --os linux --arch x64 \
|
--configuration Release --os linux-musl --arch x64 \
|
||||||
/t:PublishContainer -p ContainerRegistry=ghcr.io \
|
/t:PublishContainer -p ContainerRegistry=ghcr.io \
|
||||||
-p ContainerRepository=${{ github.repository }} -p:ContainerImageTags='"${{ steps.metadata.outputs.APP_VERSION }};latest"'
|
-p ContainerRepository=${{ github.repository }} -p:ContainerImageTags='"${{ steps.metadata.outputs.APP_VERSION }};latest"'
|
||||||
@@ -10,8 +10,23 @@
|
|||||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||||
<!-- To avoid error on lock file not found -->
|
<!-- To avoid error on lock file not found -->
|
||||||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
|
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
|
||||||
|
<!--
|
||||||
|
Low-traffic single-user admin UI: trade GC throughput for a much smaller heap.
|
||||||
|
Server GC (the Web SDK default) reserves one heap per CPU core.
|
||||||
|
-->
|
||||||
|
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||||
|
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>
|
||||||
|
<TieredPGO>false</TieredPGO>
|
||||||
|
<!-- No localized content, so skip loading ICU entirely (alpine ships no ICU anyway) -->
|
||||||
|
<InvariantGlobalization>true</InvariantGlobalization>
|
||||||
|
<ContainerBaseImage>mcr.microsoft.com/dotnet/aspnet:10.0-alpine</ContainerBaseImage>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- No MSBuild property exists for this one; lands in runtimeconfig.json for both build paths -->
|
||||||
|
<RuntimeHostConfigurationOption Include="System.GC.ConserveMemory" Value="9" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\.dockerignore">
|
<Content Include="..\.dockerignore">
|
||||||
<Link>.dockerignore</Link>
|
<Link>.dockerignore</Link>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS base
|
||||||
USER $APP_UID
|
USER $APP_UID
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using CaddyManager.Components;
|
using CaddyManager.Components;
|
||||||
|
using Microsoft.AspNetCore.Components.Server;
|
||||||
using MudBlazor.Services;
|
using MudBlazor.Services;
|
||||||
using NetCore.AutoRegisterDi;
|
using NetCore.AutoRegisterDi;
|
||||||
|
|
||||||
@@ -6,7 +7,6 @@ var builder = WebApplication.CreateBuilder(args);
|
|||||||
|
|
||||||
// Add services to the container.
|
// Add services to the container.
|
||||||
builder.Services
|
builder.Services
|
||||||
.AddMudServices()
|
|
||||||
.AddRazorComponents()
|
.AddRazorComponents()
|
||||||
.AddInteractiveServerComponents();
|
.AddInteractiveServerComponents();
|
||||||
|
|
||||||
@@ -15,7 +15,20 @@ builder.Services.RegisterAssemblyPublicNonGenericClasses(System.Reflection.Assem
|
|||||||
.Where(t => t.Name.EndsWith("Service"))
|
.Where(t => t.Name.EndsWith("Service"))
|
||||||
.AsPublicImplementedInterfaces();
|
.AsPublicImplementedInterfaces();
|
||||||
|
|
||||||
builder.Services.AddSignalR(e => { e.MaximumReceiveMessageSize = 102400000; });
|
builder.Services.AddSignalR(e =>
|
||||||
|
{
|
||||||
|
// Caddyfiles are kilobytes; this is generous headroom for Monaco editor round-trips
|
||||||
|
e.MaximumReceiveMessageSize = 512 * 1024;
|
||||||
|
e.StreamBufferCapacity = 5;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Keep as little per-circuit state resident as practical for a single-user admin UI
|
||||||
|
builder.Services.Configure<CircuitOptions>(o =>
|
||||||
|
{
|
||||||
|
o.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(1);
|
||||||
|
o.DisconnectedCircuitMaxRetained = 5;
|
||||||
|
o.MaxBufferedUnacknowledgedRenderBatches = 3;
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddMudServices(config =>
|
builder.Services.AddMudServices(config =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -524,6 +524,7 @@
|
|||||||
"NetCore.AutoRegisterDi": "[2.2.1, )"
|
"NetCore.AutoRegisterDi": "[2.2.1, )"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"net10.0/linux-musl-x64": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,6 +163,10 @@ services:
|
|||||||
DockerService__CaddyConfigPathInContainer: "/etc/caddy/Caddyfile"
|
DockerService__CaddyConfigPathInContainer: "/etc/caddy/Caddyfile"
|
||||||
# To have the access to the caddy config file
|
# To have the access to the caddy config file
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
|
# The .NET GC sizes its heap against the cgroup limit, so this both caps the worst
|
||||||
|
# case and makes the runtime self-tune downward. Raise it if you run many configs.
|
||||||
|
mem_limit: 256m
|
||||||
|
memswap_limit: 256m
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -19,6 +19,10 @@
|
|||||||
CaddyService__ConfigDir: "/config"
|
CaddyService__ConfigDir: "/config"
|
||||||
DockerService__CaddyContainerName: "caddy"
|
DockerService__CaddyContainerName: "caddy"
|
||||||
user: "1000:1000"
|
user: "1000:1000"
|
||||||
|
# The .NET GC sizes its heap against the cgroup limit, so this both caps the
|
||||||
|
# worst case and makes the runtime self-tune downward.
|
||||||
|
mem_limit: 256m
|
||||||
|
memswap_limit: 256m
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user