Merge feature/ops-1: TrueNAS deployment (compose + backup sidecar + nginx proxy + prod Dockerfiles), Gitea CI draft, German ops guide [god-QA: 18/18+47/47+e2e 48/48]

This commit is contained in:
2026-06-06 07:42:18 +02:00
12 changed files with 837 additions and 42 deletions

View File

@@ -1,20 +1,23 @@
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
# Build context: repo root (includes GerbilManager.ServiceDefaults).
# docker build -f GerbilManagerWebAPI/Dockerfile -t gerbilmanager-api .
ENV ASPNETCORE_URLS=http://+:80
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG configuration=Release
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY ["GerbilManagerWebAPI/GerbilManagerWebAPI.csproj", "GerbilManagerWebAPI/"]
RUN dotnet restore "GerbilManagerWebAPI/GerbilManagerWebAPI.csproj"
COPY . .
WORKDIR "/src/GerbilManagerWebAPI"
ARG configuration=Release
RUN dotnet publish "GerbilManagerWebAPI.csproj" -c $configuration -o /app/publish /p:UseAppHost=false
FROM base AS final
# Restore: project files only for layer-cache efficiency.
COPY GerbilManager.ServiceDefaults/GerbilManager.ServiceDefaults.csproj GerbilManager.ServiceDefaults/
COPY GerbilManagerWebAPI/GerbilManagerWebAPI.csproj GerbilManagerWebAPI/
RUN dotnet restore GerbilManagerWebAPI/GerbilManagerWebAPI.csproj
# Full source copy + publish.
COPY GerbilManager.ServiceDefaults/ GerbilManager.ServiceDefaults/
COPY GerbilManagerWebAPI/ GerbilManagerWebAPI/
WORKDIR /src/GerbilManagerWebAPI
RUN dotnet publish GerbilManagerWebAPI.csproj -c Release -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final
WORKDIR /app
# .NET 10 containers default to ASPNETCORE_HTTP_PORTS=8080 bound on all interfaces.
EXPOSE 8080
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "GerbilManagerWebAPI.dll"]

View File

@@ -50,12 +50,9 @@ app.MapDefaultEndpoints();
app.MapOpenApi();
app.MapScalarApiReference();
if (app.Environment.IsDevelopment())
{
// Aspire provisions an empty database in dev — bring the schema up to date.
using var scope = app.Services.CreateScope();
// Apply EF migrations at startup (no-op if schema is current; safe for single-instance deploy).
using (var scope = app.Services.CreateScope())
scope.ServiceProvider.GetRequiredService<ApplicationContext>().Database.Migrate();
}
app.UseCors(LanCorsPolicy);