badgen / badgen.net

Fast badge service
https://badgen.net
ISC License
1.45k stars 128 forks source link

Add badge for docker image meta #185

Open styfle opened 5 years ago

styfle commented 5 years ago

microbadger.com shows the size, number of layers, and version of a docker image.

image

It would be nice if badgen could support this service (I am not sure if an API is available).

https://images.microbadger.com/badges/image/node.svg https://images.microbadger.com/badges/image/elasticsearch:2.3.1.svg https://images.microbadger.com/badges/image/mhart/alpine-node:base-10.12.0.svg

styfle commented 5 years ago

I found the API ✨

https://api.microbadger.com/v1/images/node https://api.microbadger.com/v1/images/elasticsearch https://api.microbadger.com/v1/images/mhart/alpine-node

It's just super slow 🤷‍♂️

amio commented 5 years ago

Indeed it's extremely slow 🤦‍♂️

amio commented 5 years ago

Badgen's requests would timeout at 3 seconds (to make sure response for GitHub before it's timeout). We need to find a faster api for this, maybe official docker hub api or some other handy alternative. Or help them speed up this. A simple CDN cache would do the work.

styfle commented 5 years ago

I looked at the official docker hub api but it doesn't seem to aggregate the sum of the layers. You might be able to get each layer individually with several api calls and then perform the sum yourself.

That's basically what package phobia does for npm...but even npm isn't interested in adding this feature to their registry. So docker will likely avoid this too 😞

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

styfle commented 5 years ago

Should we keep this issue open? I think the idea of image size as a badge is relevant, even if it doesn't come from microbadger service.

amio commented 5 years ago

@styfle Sure

amio commented 5 years ago

Seems we can get layers info from official registry api https://docs.docker.com/registry/spec/api/#pulling-an-image

While I hate to add another token 😾

paolomolo commented 4 years ago

Support for the docker build status similar to shield.io would be useful as well https://img.shields.io/docker/build/vuejs/ci

image