1
0
Fork 0
mirror of https://github.com/imjasonh/wasimg synced 2026-07-07 00:34:05 +00:00
No description
Find a file
Jason Hall ee773a9bb5
update
Signed-off-by: Jason Hall <jason@chainguard.dev>
2023-07-20 12:36:17 -04:00
.gitignore update 2023-07-20 12:36:17 -04:00
go.mod update 2023-07-20 12:36:17 -04:00
go.sum update 2023-07-20 12:36:17 -04:00
hello_other.go update 2023-07-20 12:36:17 -04:00
hello_wasm.go update 2023-07-20 12:36:17 -04:00
LICENSE initial commit 2022-10-13 14:38:06 -04:00
main.go update 2023-07-20 12:36:17 -04:00
README.md update 2023-07-20 12:36:17 -04:00

wasimg

wasimg bundles a Wasm module into an OCI manifest, and pushes it to an OCI registry.

For example:

$ wasimg my-module.wasm example.com/my-project/my-module
example.com/my-project/my-module@sha256:a7bb950a6cf95fd1dfc55907ec997e37840c71f6840d0c32481e7b8392490022

It doesn't require Docker or Dockerfiles, and it reuses your pre-configured registry credentials by default.

Installation

go install github.com/imjasonh/wasimg@latest

Usage

Build a wasm module, for example, build wasimg itself:

GOOS=wasip1 GOARCH=wasm go build -o wasimg.wasm .

If you already have a wasm module, you can skip this step.

Then use wasimg to bundle that wasm module and push it to a registry:

$ wasimg wasimg.wasm ttl.sh/wasimg
ttl.sh/wasimg@sha256:caea81fc44d4d92280a4bc7ceaccf15b3466792c312c9fa38446f73ce358ee3c

This prints the image reference of the pushed image, which you can run:

$ docker run \
  --runtime=io.containerd.wasmedge.v1 \
  --platform=wasip1/wasm \
  ttl.sh/wasimg@sha256:caea81fc44d4d92280a4bc7ceaccf15b3466792c312c9fa38446f73ce358ee3c

Try it out to see what happens!