ktock / container2wasm

Container to WASM converter
https://ktock.github.io/container2wasm-demo/
Apache License 2.0
2.03k stars 80 forks source link

`create-spec`: support images with nested index #208

Closed ktock closed 9 months ago

ktock commented 9 months ago

This commit fixes create-spec to allow processing nested image index and tries to fix #207 .

$ mkdir /tmp/testimg2
$ crane pull --format=oci alpine:3.14 /tmp/testimg2/
$ cat /tmp/testimg2/index.json
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.oci.image.index.v1+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
         "size": 1638,
         "digest": "sha256:0f2d5c38dd7a4f4f733e688e3a6733cb5ab1ac6e3cb4603a5dd564e5bfb80eed"
      }
   ]
}
...
$ buildx build --progress=plain --build-arg TARGETARCH=amd64 --build-arg TARGETPLATFORM=linux/amd64 --platform=linux/amd64 -f Dockerfile --build-context assets=. --output type=local,dest=/tmp/out --build-arg OUTPUT_NAME=out.wasm --build-arg LINUX_LOGLEVEL=0 --build-arg INIT_DEBUG=false /tmp/testimg2
...
#22 0.081 Trying to unpack image as an OCI image
#22 0.081 nested manifest: processing [{application/vnd.docker.distribution.manifest.v2+json sha256:d6b6cdc5273a8950b39d09ce83f49716daead8624489fb76a70a3b45c343c3c6 528 [] map[] [] 0xc0000765a0 }]