Docker container that downloads a WASM compiled file and running using wasmedge runtime. Available as an open web service in Eyevinn Open Source Cloud.
Build container image:
% docker build -t wasm-runner:local .
Create a sample application (example in Rust)
fn main() {
println!("Hello, world!");
}Compile to wasm:
% rustup target add wasm32-wasip1
% rustc main.rs --target wasm32-wasip1
Upload main.wasm to a bucket for download and then run the container providing the URL to the WASM file:
% docker run --rm \
-p 8080:8080 \
-e WASM_URL=https://eyevinnlab-birme.minio-minio.auto.prod.osaas.io/code/main.wasm \
wasm-runner:local
Alternatively, provide a GitHub repository URL containing a .wasm file:
% docker run --rm \
-p 8080:8080 \
-e GITHUB_URL=https://github.com/<org>/<repo>/ \
wasm-runner:local
For private repositories, provide a GitHub personal access token:
% docker run --rm \
-p 8080:8080 \
-e GITHUB_URL=https://github.com/<org>/<repo>/ \
-e GITHUB_TOKEN=<token> \
wasm-runner:local
You can specify a branch using a URL fragment:
% docker run --rm \
-p 8080:8080 \
-e GITHUB_URL=https://github.com/<org>/<repo>#<branch> \
wasm-runner:local
The entrypoint will clone the repository, find the first .wasm file, and run it. The WASM module is expected to follow the WASI convention and export a _start entry point (the default for wasmedge).
The WASM application main.wasm can now be invoked through the HTTP server on port 8080. Provides these endpoints:
| Method | Path | Description |
|---|---|---|
| GET | / | Invoke the application and return what the application writes to STDOUT |
| POST | / | Invoke the application and the request body is provided to the application on STDIN. Return STDOUT output |
% curl http://localhost:8080/
Hello, world!
See CONTRIBUTING
This project is licensed under the MIT License, see LICENSE.
Join our community on Slack where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:
- Further development of this component
- Customization and integration of this component into your platform
- Support and maintenance agreement
Contact sales@eyevinn.se if you are interested.
Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in blogs and by open sourcing the code we have written.
Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!