roche-rs / roche

A cli for building serverless rust containers
https://roche-rs.org
Apache License 2.0
17 stars 3 forks source link

Add WASI support #5

Open No9 opened 3 years ago

No9 commented 3 years ago

Given the separation we have between functions.rs and the build system it should be fairly trivial to output the executable as a WASI file. The base rust image https://quay.io/repository/roche/alpine-libgcc would need to be updated to include the wasm32 target rustup target add wasm32-wasi and the build system would have to add cargo build --target wasm32-wasi to the cargo commands. https://github.com/bytecodealliance/wasmtime/blob/main/docs/WASI-tutorial.md#from-rust

Rather than packaging to a runtime container https://github.com/roche-rs/roche/blob/main/src/template/Release.Dockerfile#L5 It might be better to wrap the outputs with an OCI https://github.com/engineerd/wasm-to-oci

And possibly utilised in something like https://github.com/deislabs/krustlet It would be good to understand what the potential deployment targets are for a WASM service. Research to be captured here.

No9 commented 3 years ago

Cargo already has a fully integrated WASI stack https://github.com/bytecodealliance/cargo-wasi Networking has yet to land in WASI https://github.com/WebAssembly/WASI/pull/312 Minipot is a FreeBSD container platform based on Nomad that could target such an environment https://github.com/pizzamig/minipot