A build environment for WASI - See https://gitlab.com/no9/wasi-build
328
The Web Assembly System Interface (WASI) is designed to allow the execution of Web Assembly outside of the browser.
This technology currently requires some specific environment configuration that can clash with some setups. This project aims to enable people to build and run WASI projects as friction free as possible.
Based on the WASI Tutorial
First create a Rust Project
$ cargo init hello --bin
Then create a docker file next to hello project directory:
FROM wasi-build:latest
WORKDIR /usr/src/
COPY hello hello
WORKDIR /usr/src/hello
RUN cargo +nightly build --target wasm32-unknown-wasi
CMD [ "wasmtime", "target/wasm32-unknown-wasi/debug/hello.wasm"]
Then build and run the project
$ docker build -t wasi-rust-example .
$ docker run wasi-rust-example:latest
See https://gitlab.com/no9/wasi-build/tree/master/examples/rust for a working example
docker pull number9/wasi-build:latest