fix: image digest for docker-container builds
I found that !81 (closed) is still not merged, so I created this MR based on it and my suggestions.
We have 3 possible situations related to image pinning:
- for image created with
docker build
ordocker buildx build
usingdocker
driver the digest can be extracted fromdocker image inspect
- for singlearch image created with
docker buildx build
usingdocker-container
driver the digest can be computed or extracted fromdocker buildx imagetools inspect
(I haven't seen a manifests list containing a single manifest but it is theoretically possible) - for multiarch image the digest can't be added because each platform specific image has its own digest
I also added tests for all these situations.
Thank you and sorry for not creating this MR earlier)