susumuishigami / wasi-http-sample

My wasi-http simple sample

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

概要

WASM-WASIを使って簡易的なWebサーバーを作ってみた。 Dockerがあれば開発できるようにした。

Docker Desktop for mac で動作確認しています。

setup

$ docker compose build

compile

$ docker compose run --rm dev cargo build --target wasm32-wasi

build image

$ docker buildx build --platform wasi/wasm32 --provenance=false -t wasi-http wasi-http

execute

Enable: Docker Desktop > "Features in development" > "Use containerd for pulling and storing images"

$ docker container run --rm --runtime=io.containerd.wasmedge.v1 --platform=wasi/wasm32 -p 7878:7878 wasi-http

ブラウザで http://localhost:7878 にアクセスすると Hello, World と表示される

run.sh

compile, build, executeをまとめて実行します

$ ./run.sh

参考にしたサイト

以下を参考にしました

About

My wasi-http simple sample


Languages

Language:Rust 61.5%Language:Shell 21.9%Language:Dockerfile 16.6%