Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate what to have as image build output (jib-image.json, jib-image.digest, and jib-image.id) for multi-platform image building #2751

Open
chanseokoh opened this issue Sep 3, 2020 · 2 comments

Comments

@chanseokoh
Copy link
Member

Should we write multiple jib-image.digest and jib-image.id files for each manifest? What about the file names? Should we also write a digest of a manifest list (potentially with a different name)? Or, should we write only a single digest for a manifest list?

Does it make sense change the JSON format of jib-image.json? Should we keep backward compatibility?

On the technical side, we need to figure out the right return type of PushImageStep after sorting out these questions:

/**
* Pushes a manifest or a manifest list for a tag. If not a manifest list, returns the manifest
* digest ("image digest") and the container configuration digest ("image id") as {@link
* BuildResult}. If a manifest list, returns the manifest list digest only.
*/
// TODO: figure out the right return value and type when pushing a manifest list.
class PushImageStep implements Callable<BuildResult> {

@tom-haines
Copy link

@chanseokoh if relevant, whilst docker exporter does not currently support exporting manifest lists it does allow to output tar bundles, but only supports one platform at a time.

Example buildx commands re amd64 first, and arm64 at end:

docker buildx build --platform linux/amd64 -o type=docker,dest=/tmp/helloworld/amd64.tar .
tar xf -C amd64 amd64.tar
tree .

output:

├── Dockerfile
├── amd64
│   ├── blobs
│   │   └── sha256
│   │       ├── 16ec32c2132b43494832a05f2b02f7a822479f8250c173d0ab27b3de78b2f058
│   │       ├── 1b307460a9df24f41e954a977e17a389633f6cde89fd75efa93b4259a69f8966
│   │       ├── 34f1332d72bf8b6edcc1a4d11f3310cb84c0a69b6f9374dad77253ad07c4f308
│   │       └── f90645af5f5b704bdd16861777f8ac9c50a405a397b7cb32d6cf34b6f4b928ee
│   ├── index.json
│   ├── manifest.json
│   └── oci-layout
└── amd64.tar
$ cat amd64/manifest.json | jq -r

output:

[
  {
    "Config": "blobs/sha256/34f1332d72bf8b6edcc1a4d11f3310cb84c0a69b6f9374dad77253ad07c4f308",
    "RepoTags": null,
    "Layers": [
      "blobs/sha256/16ec32c2132b43494832a05f2b02f7a822479f8250c173d0ab27b3de78b2f058",
      "blobs/sha256/f90645af5f5b704bdd16861777f8ac9c50a405a397b7cb32d6cf34b6f4b928ee"
    ]
  }
]

any platforms available via docker buildx build can be saved locally.

example

docker buildx build --platform linux/arm64 -o type=docker,dest=/tmp/helloworld/arm64.tar .

It seems to support building each image via qemu, but omits creating a mutli-platform manifest wrapper.

FROM ubuntu:20.04
RUN apt-get update && apt-get install -y curl

@chanseokoh
Copy link
Member Author

@tom-haines thanks for the info!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants