fix: Docker-based production build and CI deployment for documentation#54
Merged
Merged
Conversation
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prod,serve, andcaddytargets by usingadditional_contextsto loadreadmes/as the docs source, replacing the staledocusaurus/docs/copynpm installto the Dockerfilebasestage so all targets share dependencies, and addNODE_OPTIONSfor memory allocation during multi-locale buildsadditional_contextsto alldocker-compose.ymlservices (dev,serve,caddy)custom.cssthat caused the minifier to produce broken selectors (e.g.;.navbar), silently skipped by browsers/init.jsfromdocusaurus.config.jsscriptsdocs-deploy.ymlto use Docker build (matching the Dockerfileprodtarget) instead of barenpm install/npm run build, and moveconfigure-pagesto the deploy jobContext
The
prod,serve, andcaddyDocker targets were broken because they relied on adocusaurus/docs/directory that was stale and out of sync with the actual documentation inreadmes/. Thedocker-compose.ymldevservice worked around this by mountingreadmes/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 buildwith Node 22, which diverged from the Dockerfile's Node 24 environment and lacked theadditional_contextsmechanism for loading docs.Test plan
docker compose build servecompletes successfully for all 3 locales (en, es, pt)docker compose up serverenders pages with correct purple theme atlocalhost:3000magma/magma-documentationwith Pages enabled