fix(docker): take the version from the image, not from the container's env

Portainer's recreate and a copied run config carry the previous image's
APP_VERSION into a container built from the new one, so the server kept
announcing the old release and clients never handed over to the new
bundle. The Dockerfile now writes the version into server/VERSION, which
the server reads before APP_VERSION, and prerelease bundles take their
version from the same build argument.
This commit is contained in:
Maurice
2026-10-07 15:57:52 +02:00
parent c956fe92ba
commit c6b6b83d38
6 changed files with 108 additions and 7 deletions
+5 -4
View File
@@ -5,11 +5,12 @@ import { visualizer } from 'rollup-plugin-visualizer';
import { rtlTextAlias, plyrSpriteAlias } from './rtlTextAlias.js';
import { readFileSync } from 'node:fs';
// The version this bundle is built as, baked in at build time. The release image
// bumps every package.json before it builds, so this matches the server's
// APP_VERSION there; a source checkout matches the server's own package.json.
// The version this bundle is built as, baked in at build time. The Docker build
// passes APP_VERSION, which the prerelease images need because they do not bump
// package.json; a source checkout matches the server's own package.json.
// The server hands the release notice only to a bundle built for its version.
const UI_VERSION = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version;
const BUILD_VERSION = process.env.APP_VERSION && process.env.APP_VERSION !== 'dev' ? process.env.APP_VERSION : null;
const UI_VERSION = BUILD_VERSION ?? JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version;
// `npm run build:analyze` writes dist/stats.html — a treemap of what actually ended
// up in each chunk. The plain build only reports chunk sizes, which tells you a chunk