container2wasm
container2wasm copied to clipboard
no-conversion without imagemounter
Using imagemounter, which works great for browsers, comes with some unnecessary overhead. This is an alternative solution that bypasses the network and uses the built-in WASI capability to map folders. WASI filesystem does not have permissions. To overcome this, we export the container rootfs as a SquashFS image.
Goal:
wazero run --mount /tmp/riscv-python:/ext/bundle riscv64-squash.wasm python
Or,
wazero run --mount /tmp/riscv-python:/some/folder riscv64-squash.wasm --external-bundle /some/folder python
Please fix linter errors as well.
https://github.com/ktock/container2wasm/actions/runs/10580983966/job/29343917175?pr=306#step:3:33
cmd/d2oci/main.go:93:10: Error return value of `os.Mkdir` is not checked (errcheck)
os.Mkdir(dstImgPath, 0750)
^
cmd/d2oci/main.go:98:10: Error return value of `os.Mkdir` is not checked (errcheck)
os.Mkdir(dstImgPath+"/rootfs", 0750)
^
cmd/d2oci/main.go:171:10: Error return value of `os.Mkdir` is not checked (errcheck)
os.Mkdir(path.Join(dstImgPath, "config"), 0755)
^
cmd/d2oci/main.go:294:25: printf: fmt.Errorf call has arguments but no formatting directives (govet)
return nil, fmt.Errorf("Failed to unpack the image as an OCI image:", err)