chore(docker): R2 application image with the Rust core — wasm stage, precompressed module, CSP proof on the image

Dockerfile stage 0 (rust:1.99.0-bookworm, wasm32 target, wasm-bindgen-cli
at the builder's pinned version, cargo cache mounts) builds the shipped
module with scripts/wasm-build.sh (WASM_BUILD_SHIPPED_ONLY=1); the Node
stage copies packages/core-wasm (manifest + pkg/); the runner gzips the
module and nginx serves it with gzip_static (application/wasm, 1,180,153
bytes raw, 372,275 served). docker/csp-proof/app-image.sh runs the real
image behind the DEPLOY.md CSP in headless Chromium: with
'wasm-unsafe-eval' a report is created and a zone click is applied by the
core with no script or wasm violation; without it the editor shows the
degraded notice, stays put and leaves the draft untouched; /login,
/app/account and / never request the module (15/15 checks).
This commit is contained in:
bchanot committed 2026-10-14 00:45:51 +02:00
1 parent 74fcb37564
commit 7be94d4ce6
5 files changed
+183 -7

No files matched your search

+11 -5
View File
@@ -32,11 +32,17 @@ build_module() {
target/wasm32-unknown-unknown/release/faunosteo_wasm.wasm
}
stamp="$(node scripts/wasm-stamp.mjs)"
build_module packages/core-wasm/pkg-proofs --features proofs
echo "$stamp" > packages/core-wasm/pkg-proofs/BUILD_STAMP
build_module packages/core-wasm/pkg
echo "$stamp" > packages/core-wasm/pkg/BUILD_STAMP
# WASM_BUILD_SHIPPED_ONLY=1 (the application image) builds pkg/ alone; the stamp needs node,
# absent from that stage, and only the test suites read it.
if [ "${WASM_BUILD_SHIPPED_ONLY:-0}" = 1 ]; then
build_module packages/core-wasm/pkg
else
stamp="$(node scripts/wasm-stamp.mjs)"
build_module packages/core-wasm/pkg-proofs --features proofs
echo "$stamp" > packages/core-wasm/pkg-proofs/BUILD_STAMP
build_module packages/core-wasm/pkg
echo "$stamp" > packages/core-wasm/pkg/BUILD_STAMP
fi
# The shipped module must not carry a proof export.
if grep -Eq 'panic_for_test|recurse_for_test' packages/core-wasm/pkg/faunosteo_wasm.d.ts; then