build(docker): consolidate WASM build into multi-stage Dockerfile

- Move WASM compilation from GitHub Actions into Docker build stages
- Add emsdkVersion to package.json config as single source of truth
- Implement cargo-chef for dependency caching in both WASM and server builds
- Update .dockerignore to include packed game assets while excluding unpacked
- Simplify deploy workflow by removing local WASM build steps
This commit is contained in:
2025-12-29 16:43:37 -06:00
parent a65836bd5b
commit 16fba6aabc
7 changed files with 176 additions and 102 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ anyhow = "1.0"
smallvec = "1.15.1"
bitflags = "2.9.4"
micromap = "0.1.0"
circular-buffer = "=1.1.0"
circular-buffer = "1.1.0"
parking_lot = "0.12.3"
strum = "0.27.2"
strum_macros = "0.27.2"
+16 -6
View File
@@ -21,6 +21,16 @@ await configure({
const logger = getLogger("web");
// Read emsdk version from package.json (single source of truth)
const packageJson = JSON.parse(
await fs.readFile(resolve(__dirname, "../package.json"), "utf-8")
);
const EMSDK_VERSION = packageJson.config?.emsdkVersion;
if (!EMSDK_VERSION) {
logger.error("emsdkVersion not found in package.json config");
process.exit(1);
}
type Os =
| { type: "linux"; wsl: boolean }
| { type: "windows" }
@@ -163,19 +173,19 @@ async function activateEmsdk(
};
}
// Install latest version
logger.debug("Installing latest Emscripten version...");
// Install emsdk version from package.json
logger.debug(`Installing emsdk version ${EMSDK_VERSION}...`);
const emsdkBinary = join(emsdkDir, os.type === "windows" ? "emsdk.bat" : "emsdk");
const installResult = await $`${emsdkBinary} install latest`.quiet();
const installResult = await $`${emsdkBinary} install ${EMSDK_VERSION}`.quiet();
if (installResult.exitCode !== 0) {
return {
err: `Failed to install emsdk: ${installResult.stderr.toString()}`,
};
}
// Activate latest version
logger.debug("Activating latest Emscripten version...");
const activateResult = await $`${emsdkBinary} activate latest`.quiet();
// Activate emsdk version from package.json
logger.debug(`Activating emsdk version ${EMSDK_VERSION}...`);
const activateResult = await $`${emsdkBinary} activate ${EMSDK_VERSION}`.quiet();
if (activateResult.exitCode !== 0) {
return {
err: `Failed to activate emsdk: ${activateResult.stderr.toString()}`,