container2wasm icon indicating copy to clipboard operation
container2wasm copied to clipboard

no-conversion without imagemounter

Open samyfodil opened this issue 1 year ago • 1 comments

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

samyfodil avatar Aug 14 '24 05:08 samyfodil

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)

ktock avatar Aug 28 '24 16:08 ktock