feat(backend): optional lean deployable image (WP-30 #5)

Multi-stage backend/Dockerfile (sdk build -> aspnet:10.0 runtime, ~312MB) +
docker-compose.prod.yml, additive only — not wired into CI or the existing
dev docker-compose.yml (which keeps the SDK image for dotnet run hot-reload).
New .dockerignore keeps the build context lean (node_modules alone is
~750MB) since the Dockerfile COPYs from the repo root to pick up
public/letter.css (WP-25's FE<->BE letter contract) as a sibling of backend/.

Verified for real: built the image, ran it, and curled a live
GET /api/v1/brief/preview against the running container — got back the
actual rendered letter HTML with letter.css inlined, confirming the
walk-up-from-BaseDirectory lookup resolves inside this image layout too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
eho
2026-07-30 09:35:21 +02:00
co-authored by Claude Sonnet 5
parent e7db69d8a9
commit a0d8804a53
3 changed files with 41 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
# WP-30: lean deployable image (optional — not used by the dev demo, which keeps the SDK
# image in the root docker-compose.yml for `dotnet run` hot-reload). Build from the repo
# root: `docker build -f backend/Dockerfile .`
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish backend/src/BigRegister.Api -c Release -o /app
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build /app .
# LetterHtml.Render (WP-25) walks up from AppContext.BaseDirectory looking for a sibling
# public/letter.css (the FE⇄BE letter contract) — this keeps that lookup working here too.
COPY public ./public
ENTRYPOINT ["dotnet", "BigRegister.Api.dll"]