Ship only runtime files in the nginx image's static tree - #16102
Merged
devGregA merged 3 commits intoSep 27, 2026
Merged
Conversation
Once the Tailwind CSS is built, reinstall components with --production so the CSS toolchain (tailwind cli, lightningcss and their prebuilt native binaries) is not collected, and have collectstatic skip source maps, TypeScript sources and declarations, and the npm lockfiles some packages ship in their tarballs. None of these are loaded by any page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… page Scalar enables its "Ask AI" assistant by default, which is a third-party hosted service. Disable it through data-configuration so the page stays self-contained, the same reason the bundle is served from our own static files instead of a CDN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
devGregA
force-pushed
the
fix/nginx-static-nested-lockfiles
branch
from
September 27, 2026 03:40
2b50c0f to
1ad6158
Compare
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.
Description
The nginx image copies all of
components/node_modulesinto/usr/share/nginx/html/static/throughcollectstatic, so it ships a lot that no page loads: the Tailwind CSS toolchain (the tailwind cli, lightningcss and their prebuilt native binaries), source maps, TypeScript sources and declarations, and the npm lockfiles a couple of packages include in their tarballs. This trims the static tree to the files the UI uses.yarn build:css,yarn install --production --ignore-scriptsremoves the devDependencies (34 packages) before static is collected. The compiledtailwind-out.cssis unaffected.collectstaticnow skips*.map,*.ts,*.mts,*.ctsand the four npm lockfile names. The default ignore patterns still apply.components/yarn.lockto 3.3.19.data-configuration='{"agent": {"disabled": true}}', so it stays self-contained, consistent with serving the bundle from our own static files rather than a CDN. The rest of the page is unchanged.Result on the nginx image: the static tree goes from 49,920 files to 31,191, with no
.map,.ts, lockfile or native binary left, and it is about 200 MB smaller on disk.Test results
Dockerfile.nginx-alpinelocally (linux/arm64). The build succeeds andtailwind-out.cssis present.{% static %}path referenced fromdojo/templatesthat exists in the current image still exists after the change..mapfiles are anything other than source maps, and that no shipped JS loads a.tsfile at runtime.collectstaticon Django 5.2.16 (the pinned version) with these flags over a test tree: every skipped pattern is dropped at any depth;package.json, JavaScript and default-ignored dotfiles behave as before.data-url, "Test Request" works, the "Ask AI" controls are gone, and no request leaves the host.test_hosted_ai_assistant_is_disabledtounittests/api_v3/test_apiv3_reference_docs.py. I did not run the unit test suite locally; CI runs it.ruff check(0.16.5, repo config) passes on the changed files.Documentation
No documentation change needed.
🤖 Generated with Claude Code