Skip to content

fix: Docker-based production build and CI deployment for documentation#54

Merged
lucaaamaral merged 6 commits into
magma:mainfrom
lucaaamaral:fix/docs-deploy-workflow
Feb 26, 2026
Merged

fix: Docker-based production build and CI deployment for documentation#54
lucaaamaral merged 6 commits into
magma:mainfrom
lucaaamaral:fix/docs-deploy-workflow

Conversation

@lucaaamaral
Copy link
Copy Markdown
Collaborator

Summary

  • Fix Dockerfile prod, serve, and caddy targets by using additional_contexts to load readmes/ as the docs source, replacing the stale docusaurus/docs/ copy
  • Move npm install to the Dockerfile base stage so all targets share dependencies, and add NODE_OPTIONS for memory allocation during multi-locale builds
  • Add additional_contexts to all docker-compose.yml services (dev, serve, caddy)
  • Fix production CSS theme rendering: remove invalid semicolons after nested CSS rule blocks in custom.css that caused the minifier to produce broken selectors (e.g. ;.navbar), silently skipped by browsers
  • Remove non-existent /init.js from docusaurus.config.js scripts
  • Escape curly-brace placeholders in 4 doc files so MDX does not interpret them as JSX expressions during production SSG builds
  • Rewrite docs-deploy.yml to use Docker build (matching the Dockerfile prod target) instead of bare npm install/npm run build, and move configure-pages to the deploy job

Context

The prod, serve, and caddy Docker targets were broken because they relied on a docusaurus/docs/ directory that was stale and out of sync with the actual documentation in readmes/. The docker-compose.yml dev service worked around this by mounting readmes/ as a volume at runtime, but the production targets had no equivalent mechanism.

The production theme appeared white instead of purple because semicolons after nested CSS rule closing braces (e.g. };) caused the CSS minifier to concatenate them into subsequent selectors, producing invalid CSS like ;.navbar{...} that browsers silently discarded. The dev server processed CSS differently and was unaffected.

The CI workflow used bare npm install/npm run build with Node 22, which diverged from the Dockerfile's Node 24 environment and lacked the additional_contexts mechanism for loading docs.

Test plan

  • docker compose build serve completes successfully for all 3 locales (en, es, pt)
  • docker compose up serve renders pages with correct purple theme at localhost:3000
  • CI workflow build step passes on GitHub Actions (deploy step requires Pages to be enabled on the target repo)
  • Verify deployment on magma/magma-documentation with Pages enabled

- Use COPY --from=readmes to load docs from readmes/ via
  additional_contexts instead of a stale docusaurus/docs/ copy
- Move npm install to base stage so all targets share dependencies
- Fix prod target: remove broken COPY/npm ci, add NODE_OPTIONS
  for memory allocation during multi-locale build
- Add additional_contexts to all docker-compose services
- Remove invalid semicolons after nested CSS rule blocks in custom.css
  that caused the CSS minifier to produce broken selectors (e.g.
  ";.navbar") silently skipped by browsers
- Remove non-existent /init.js from scripts in docusaurus.config.js
Replace bare npm install/build with Docker build using the same
Dockerfile prod target, ensuring CI matches local docker-compose
behavior (Node 24, additional_contexts for readmes, memory limits).
Wrap curly-brace placeholders in backticks and convert HTML style
strings to JSX objects so MDX does not interpret them as expressions
during production SSG builds.
@lucaaamaral lucaaamaral merged commit c127504 into magma:main Feb 26, 2026
6 of 8 checks passed
@lucaaamaral lucaaamaral deleted the fix/docs-deploy-workflow branch February 26, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant