Use Docker for WasmEdge app development

The appdev Docker images provide a complete WasmEdge application development environment. To use it, do the following.

On x86_64 machines

  1. $ docker pull wasmedge/appdev_x86_64:0.9.0
  2. $ docker run --rm -v $(pwd):/app -it wasmedge/appdev_x86_64:0.9.0
  3. (docker) #

Here is the Dockerfile and Docker Hub image.

On arm64 machines

  1. $ docker pull wasmedge/appdev_aarch64:0.9.0
  2. $ docker run --rm -v $(pwd):/app -it wasmedge/appdev_aarch64:0.9.0
  3. (docker) #

Here is the Dockerfile and Docker Hub image.

The WasmEdge application development Docker image installs the following components.

  • WasmEdge CLI and shared libraries
  • WasmEdge with Tensorflow extension CLI and libraries (x86_64 only)
  • Golang
  • Rust
  • Node.js with WasmEdge addons
  • Examples in the /root/examples/ folder

Examples

Hello World. See more simple examples

  1. $ wasmedge hello.wasm world
  2. hello
  3. world

Use AOT to run it much faster.

  1. $ wasmedgec hello.wasm hello.wasm
  2. $ wasmedge hello.wasm world
  3. hello
  4. world

Here are some JavaScript examples. See more

  1. $ wasmedge --dir .:. qjs.wasm hello.js 1 2 3
  2. Hello 1 2 3
  3. $ wasmedge-tensorflow-lite --dir .:. qjs_tf.wasm tf_image_classify.js
  4. label: Hot dog
  5. confidence: 0.8941176470588236

Build and publish the appdev images

Run these commands to build and publish the appdev Docker images.

Build on an x86_64 machine

  1. docker build -t wasmedge/appdev_x86_64:0.9.0 -f Dockerfile.appdev_x86_64 ./
  2. docker image push wasmedge/appdev_x86_64:0.9.0

Build on an ARM64 / aarch64 machine

  1. docker build -t wasmedge/appdev_aarch64:0.9.0 -f Dockerfile.appdev_aarch64 ./
  2. docker image push wasmedge/appdev_aarch64:0.9.0