Repository navigation
Conversation
- Multi-stage Dockerfile (build -> prune -> runtime) with a BuildKit yarn cache mount, so the 2.2 GB yarn cache never lands in a layer - Add .dockerignore (also keeps local configs/secrets out of images) - Pass GIT_SHA/GIT_REF as build args instead of .gitsha/.gitref files - checkForUpdates: read sha/ref from env, fetch remote sha via the GitHub API (no git binary needed), skip non-branch refs (PR images) - Move vite + build plugins to dependencies since `yarn start` builds the client on boot; lazy-load vite-plugin-checker (dev only) - Move openai/gpt-tokenizer to @rm/locales devDependencies and drop the unused `generate` re-export so the server no longer loads them - Remove unused monaco-editor devDependency (playground loads Monaco from jsDelivr via @monaco-editor/loader) - docker.yml: buildx, current action versions, GHA layer cache Image: 3 GB -> 608 MB uncompressed (~1.4 GB -> ~207 MB compressed) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dropping the `generate` re-export also removed its `dotenv.config()` side effect. vite.config.js relied on it (via ReactMap.js/`yarn build`) to pick up NODE_CONFIG_ENV from `.env` for the dist-* output dir. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- vite.config: name the Sentry release from SENTRY_RELEASE/GIT_SHA; the plugin used to auto-detect it via `git rev-parse HEAD`, which worked in the old image because it shipped git and .git - Dockerfile: keep NPM_CONFIG_PREFIX/PATH for derived images - docker.yml: provenance: false so ghcr still gets a single manifest instead of an attestation index Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI images never contained them and the documented setup mounts configs as volumes, so baking them into local builds is not something to keep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Docker image now receives GIT_SHA/GIT_REF as build args and checkForUpdates no longer reads these files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Superseded by #6, which tracks chore/docker-slim-v2 (the branch behind upstream WatWowMap#1279). |
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
Slims the Docker image from 3 GB → 608 MB uncompressed (~1.4 GB → ~207 MB compressed) and removes the runtime dependency on
git/.git.:maintoday.git/gitbinaryWhere the size went
yarn installleft the yarn download cache (/usr/local/share/.cache, 2.2 GB) in the layer..dockerignore, so localdocker builds copied the host'snode_modules,distand config files.Changes
build→prune→runtime.gitis only installed in the build stage, for the git-URL dependencieschalkercliandpassport-discord.node:22.23.4-alpinewith productionnode_modules. Paths stay under/home/node, so existing compose mounts keep working.CMD ["yarn", "start"]..dockerignore: new. It also keepsconfig/local.json,config/areas.json,server/src/configs/**and.envout of locally built images.GIT_SHA/GIT_REFbuild args become env vars and replace the.gitsha/.gitreffiles.checkForUpdates.js:application/vnd.github.sha) instead ofgit ls-remote.refs/pull/123/mergeas branch"123".yarn startrebuilds the client on every boot, baking in the user's title, theme, start location, GA, Sentry and favicon. So the build toolchain is a real runtime dependency:vite,@vitejs/plugin-react-swc,rollup-plugin-delete,@sentry/vite-pluginand@rm/vite-pluginsmove todependencies.vite-plugin-checkeris lazy-loaded (dev only) and stays a devDependency.openaiandgpt-tokenizer(only used by the CIlocales:generatejob) move to@rm/localesdevDependencies. The unusedgeneratere-export is dropped, so the server no longer loads them at boot.index.jsnow callsdotenv.config()itself to keep the.envloadinggenerate.jsused to provide as a side effect;vite.config.jsrelies on it forNODE_CONFIG_ENV→dist-*.monaco-editordevDependency is removed. The playground keeps working:@monaco-editor/loaderloads Monaco fromcdn.jsdelivr.net/npm/monaco-editor@0.55.1, and the npm copy (^0.41) was never bundled. Install now prints an unmet-peer warning.docker.yml:.gitsha/.gitrefsteps and addssetup-buildx-action.type=gha,mode=max).permissions(contents: read,packages: write).Parity fixes (side effects of the old image that were kept)
@rm/localesstill loads.envon import.generate.jsused to do this as a side effect, andvite.config.jsrelies on it forNODE_CONFIG_ENV→dist-*.SENTRY_RELEASE→GIT_SHA. It used to auto-detect viagit rev-parse HEAD, which only worked because the old image shippedgitand.git.NPM_CONFIG_PREFIX/PATHare kept for derived images.provenance: false, so ghcr still receives a single image manifest. Without it, buildx would publish an attestation index with an extraunknown/unknownentry.Intentional behavior changes
git branch/git rev-parse). The tracked empty.gitref/.gitshaplaceholders made the old code fall through to git correctly. Only the remote lookup changed (see below). A branch that doesn't exist upstream now logsUnable to get remote SHAinstead of a false "new version available" with an empty sha./are no longer truncated (feature/xused to becomefeature). PR images skip the check.git ls-remotehad none, and startup awaits it.api.github.com(unauthenticated limit: 60 requests/hour per IP, and the check runs once at startup) instead ofgit ls-remotetogithub.com.yarn dev,yarn lint,yarn locales:generate,yarn testetc. don't work inside the container.yarn start,yarn server,yarn build,yarn masterfileand themigrate:*scripts do.docker buildwithout build args: the update check is skipped quietly. Old local builds hadgit+.git, but git refused withdubious ownership in repository at '/home/node'and printed a false "new version available". Pass--build-arg GIT_SHA=$(git rev-parse HEAD) --build-arg GIT_REF=$(git symbolic-ref HEAD)to enable the check.application/vnd.oci.image.manifest.v1+json) instead of Docker v2. It is still a single manifest (no index,provenance: false), and the docker, podman and watchtower versions of the last several years support it.CMD ["yarn", "start"](previously the basenodeREPL). Compose setups that setcommandare unaffected.yarn installwarning: it now prints an unmet-peer warning formonaco-editor.Old vs new comparison
The same mounted
local.json(customheaderTitle, MariaDB) was used in every setup. Probes:/,/playground,/index.html,/favicon.ico,/locales/{en,de}/translation.json, a 404,/api/v1/config,/auth/discord,POST /graphql, the config baked into the bundle, and sha256 of everydistfile.main)yarn start)distfiles identicaldocker build(no args, config mounted)distidentical, startup build bakes the config in bothyarn start)watwowmap/reactmap:main(v1.57.0)fabio1988/reactmap:pr-5(v1.55.2)index.htmland bundle; CI-built new image is identical to the local new buildPR CI on the fork:
lint✓,dockerbuild + push ✓ (cache, build args, single manifest).Testing
yarn lint,yarn prettier,yarn config:check,yarn masterfile,yarn testandyarn buildall pass locally. These are the same steps aslint.yml,config.ymlandrelease.yml.openai/gpt-tokenizerstill resolve foryarn locales:generate, sincelocales.ymldoes a full install.GET /andGET /playgroundreturn 200.refs/heads/mainreports the newer remote sha with thedocker-compose pullhint.refs/pull/12/mergeskips cleanly.v22.23.4, which includes the CVE-2026-111497 (Node2Shell) brotli fix.🤖 Generated with Claude Code