FROM debian:trixie # enable more components and update repos RUN apt update -y # install libraries RUN apt install -y \ libasound2-dev \ libpulse-dev \ libwayland-dev \ libxrandr-dev \ libxinerama-dev \ libxcursor-dev \ libxi-dev \ libxkbcommon-dev \ libsdl2-dev \ libclang-dev # Install build tools RUN apt install -y \ rustup \ gcc \ g++ \ cmake \ git \ xz-utils # Install emscripten RUN git clone https://github.com/emscripten-core/emsdk.git /emsdk RUN /emsdk/emsdk install latest RUN /emsdk/emsdk activate latest # add build user RUN useradd -u 1000 -m builder -d /home/builder USER builder # Install rust and toolchain RUN rustup default stable RUN rustup target add wasm32-unknown-emscripten # set emscripten env ENV RUSTFLAGS="-C panic=unwind" ENV EMCC_CFLAGS="-O3 -sUSE_GLFW=3 -sASSERTIONS=1 -sWASM=1 -sASYNCIFY -sGL_ENABLE_GET_PROC_ADDRESS=1 -sEXPORTED_RUNTIME_METHODS=HEAPF32,ccall,cwrap" ENV EMSDK=/emsdk ENV EMSDK_NODE=/emsdk/node/22.16.0_64bit/bin/node ENV PATH="${EMSDK}/upstream/bin:${EMSDK}/upstream/emscripten:${EMSDK_NODE}:${PATH}" # build the code VOLUME /data WORKDIR /data CMD ["cargo", "build", "--target", "wasm32-unknown-emscripten", "--release"]