This commit is contained in:
Matthew Deville 2026-02-20 14:23:22 +01:00
parent 7c4b4f5f93
commit 3f379750a6
2 changed files with 22 additions and 9 deletions

View file

@ -5,15 +5,7 @@ COPY . .
RUN rustup target add wasm32-unknown-unknown
RUN cargo install wasm-bindgen-cli
RUN cargo build --release --target wasm32-unknown-unknown -p app
RUN mkdir -p static && \
wasm-bindgen --out-name 3dscene \
--out-dir static \
--target web \
target/wasm32-unknown-unknown/release/app.wasm && \
cp web/index.html static/
RUN ./build-wasm.sh
RUN cargo build --release -p server
FROM debian:trixie-slim

21
build-wasm.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
PROFILE="${1:-release}"
if [ "$PROFILE" = "dev" ]; then
PROFILE_DIR="debug"
CARGO_FLAGS=""
else
PROFILE_DIR="release"
CARGO_FLAGS="--release"
fi
cargo build $CARGO_FLAGS --target wasm32-unknown-unknown -p app
mkdir -p static
wasm-bindgen --out-name 3dscene \
--out-dir static \
--target web \
"target/wasm32-unknown-unknown/$PROFILE_DIR/app.wasm"
cp web/index.html static/