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:
@@ -0,0 +1,12 @@
|
|||||||
|
# WP-30: backend/Dockerfile does `COPY . .` from the repo root (needs public/letter.css as a
|
||||||
|
# sibling of backend/) — without this, that copy would drag in node_modules (~750MB), .git,
|
||||||
|
# and every build/output directory, defeating the point of a "lean" image.
|
||||||
|
.git
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
storybook-static
|
||||||
|
backend/**/bin
|
||||||
|
backend/**/obj
|
||||||
|
backend/**/bigregister.db*
|
||||||
|
backend/openzaak
|
||||||
|
documentation.json
|
||||||
@@ -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"]
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# WP-30: optional lean deployable backend image — NOT used by the dev demo (docker-compose.yml
|
||||||
|
# keeps the SDK image there for `dotnet run` hot-reload; rewriting that one into a prod image
|
||||||
|
# would lose the bind-mount hot-reload it's for). This is an additive artifact only, not wired
|
||||||
|
# into CI. `docker compose -f docker-compose.prod.yml up --build` → Swagger at :5000/swagger.
|
||||||
|
services:
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: backend/Dockerfile
|
||||||
|
environment:
|
||||||
|
- ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
- ASPNETCORE_URLS=http://+:8080
|
||||||
|
ports:
|
||||||
|
- '5000:8080'
|
||||||
Reference in New Issue
Block a user