OPS-1: Dockerfiles (net10 API + nginx frontend) + production config

- GerbilManagerWebAPI/Dockerfile: net7->net10 multi-stage; build context=repo
  root (includes ServiceDefaults); port 8080 (.NET 10 container default)
- gerbil-manager-web/Dockerfile: drop VITE_API_BASE_URL build-arg; nginx proxies
  /api/* to api:8080 (strip prefix), /scalar, /openapi/ -- one published port 80
- gerbil-manager-web/src/api/client.ts: default API_BASE_URL /api (relative),
  no hostname coupling at build time; Aspire still injects absolute LAN URL in dev
- GerbilManagerWebAPI/Program.cs: run EF Migrate() at startup always (not Dev-only)
- GerbilManager.ServiceDefaults/Extensions.cs: expose /health + /alive in all
  environments (compose healthcheck requires them in Production)

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 07:25:55 +02:00
parent adea82a0e7
commit 2f2e5b1f56
5 changed files with 60 additions and 42 deletions

View File

@@ -2,11 +2,12 @@ import { de } from '../strings/de'
/**
* Basis-URL der GerbilManagerWebAPI.
* Per VITE_API_BASE_URL konfigurierbar (z. B. in Docker / Aspire);
* Standard ist das lokale Dev-Profil der API (launchSettings.json, Profil "http").
* Dev (Aspire): VITE_API_BASE_URL wird von AppHost zur Laufzeit gesetzt (LAN-IP + Port).
* Produktion (Docker/nginx): kein Env-Var nötig — nginx proxyt /api/* zum API-Container,
* daher funktioniert der relative Pfad /api auf jedem Host ohne Build-Zeit-Kopplung.
*/
export const API_BASE_URL: string =
import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:5179'
import.meta.env.VITE_API_BASE_URL ?? '/api'
export class ApiError extends Error {
readonly status: number | null