From 23f52d0b58361d555cb78491f1d31356cefaecee Mon Sep 17 00:00:00 2001 From: janeza2 <49841619+janeza2@users.noreply.github.com> Date: Wed, 27 May 2026 01:09:45 +0700 Subject: [PATCH] fix(docker): keep fumadocs doc assets in Docker build context (#2741) Integrated into release/v3.8.4 --- .dockerignore | 12 +++---- tests/unit/dockerignore-docs-coverage.test.ts | 31 ++++++++++++------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.dockerignore b/.dockerignore index 494187a285..04835557d9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -41,20 +41,16 @@ blob-report # Issue #2348: The Dashboard Docs viewer reads markdown from `/app/docs` at # runtime. The previous `docs/*` block hid every file except openapi.yaml, # so the in-product help screen failed with ENOENT for every page. -# We now keep the English markdown tree but drop the bulky assets -# (translations, screenshots, raster diagrams) that account for ~45 MB -# of the ~50 MB docs directory. The Docs viewer reads the default-locale -# (English) sources at runtime, so translations are not required in the -# container image. +# We now keep the English markdown tree but drop bulky i18n mirrors (~45 MB). +# v3.8.3+ (fumadocs-mdx): `npm run build` webpack-bundles docs — keep assets referenced +# from English markdown (docs/diagrams/exported/*.svg, docs/screenshots/*.png). docs/i18n/** -docs/screenshots/** -docs/diagrams/exported/** +# Raster sources under docs/diagrams/ only (exported SVGs are required at build time). docs/diagrams/**/*.png docs/diagrams/**/*.jpg docs/diagrams/**/*.jpeg docs/diagrams/**/*.gif docs/diagrams/**/*.webp -docs/diagrams/**/*.svg # Note: `*.md` matches the root only (Go filepath.Match does not cross /), # so nested docs/**/*.md is implicitly kept without a re-include rule. *.md diff --git a/tests/unit/dockerignore-docs-coverage.test.ts b/tests/unit/dockerignore-docs-coverage.test.ts index 4e0ca4d1b2..2f8f8c6b36 100644 --- a/tests/unit/dockerignore-docs-coverage.test.ts +++ b/tests/unit/dockerignore-docs-coverage.test.ts @@ -33,6 +33,19 @@ const REQUIRED_DOCS = [ "docs/reference/ENVIRONMENT.md", ]; +// Referenced from docs/**/*.md — fumadocs-mdx webpack build fails if missing. +const REQUIRED_DOC_DIAGRAMS = [ + "docs/diagrams/exported/request-pipeline.svg", + "docs/diagrams/exported/resilience-3layers.svg", + "docs/diagrams/exported/authz-pipeline.svg", + "docs/diagrams/exported/db-schema-overview.svg", +]; + +const REQUIRED_DOC_SCREENSHOTS = [ + "docs/screenshots/01-providers.png", + "docs/screenshots/05-translator.png", +]; + // Compile .dockerignore patterns into a simple matcher. // We only need to support the directives we actually use: glob `**`, plain // path prefixes, and negations starting with `!`. @@ -120,7 +133,7 @@ test("#2348 .dockerignore keeps every doc the in-product viewer needs", () => { const missing: string[] = []; const ignored: string[] = []; - for (const docPath of REQUIRED_DOCS) { + for (const docPath of [...REQUIRED_DOCS, ...REQUIRED_DOC_DIAGRAMS, ...REQUIRED_DOC_SCREENSHOTS]) { const absPath = path.resolve(REPO_ROOT, docPath); if (!fs.existsSync(absPath)) { missing.push(docPath); @@ -139,15 +152,11 @@ test("#2348 .dockerignore keeps every doc the in-product viewer needs", () => { ); }); -test("#2348 .dockerignore still excludes the heavy i18n + screenshots dirs", () => { +test("#2348 .dockerignore still excludes the heavy i18n tree", () => { const parsed = parseDockerignore(fs.readFileSync(DOCKERIGNORE, "utf8")); - // These should NOT make it into the container — they are 45+ MB combined - // and the in-product viewer reads only the English originals at runtime. - const HEAVY_PATHS = ["docs/i18n/pt-BR/docs/AUTO-COMBO.md", "docs/screenshots/dashboard.png"]; - for (const heavy of HEAVY_PATHS) { - assert.ok( - isIgnored(heavy, parsed), - `${heavy} should be excluded from Docker context but is not — image size will balloon` - ); - } + const heavy = "docs/i18n/pt-BR/docs/AUTO-COMBO.md"; + assert.ok( + isIgnored(heavy, parsed), + `${heavy} should be excluded from Docker context but is not — image size will balloon` + ); });