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

Use docker metadata to generate combos of labels, tags, and images #3396

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

halkeye
Copy link

@halkeye halkeye commented Nov 23, 2024

Changed

  • Changed: Updated docker build scripts to include docker labels

@halkeye
Copy link
Author

halkeye commented Nov 23, 2024

Tools like renovate and dependabot use docker labels to determine where to look for changelogs
Also a few tweaks so forks can use the github actions to test things (like this PR)

Before (Especially incorrect as its not ubuntu nor 20.04, its kavita):

regctl image config --format '{{ jsonPretty .Config.Labels }}' ghcr.io/kareadita/kavita:nightly
{
  "org.opencontainers.image.ref.name": "ubuntu",
  "org.opencontainers.image.version": "20.04"
}

After

regctl image config --format '{{ jsonPretty .Config.Labels }}' ghcr.io/halkeye/kavita:nightly-0.8.4.0
{
  "org.opencontainers.image.created": "2024-11-23T06:01:02.916Z",
  "org.opencontainers.image.description": "Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.",
  "org.opencontainers.image.licenses": "GPL-3.0",
  "org.opencontainers.image.ref.name": "ubuntu",
  "org.opencontainers.image.revision": "7ccfc4b0577bb7a74785740549669d3005831b7a",
  "org.opencontainers.image.source": "https://github.com/halkeye/Kavita",
  "org.opencontainers.image.title": "Kavita",
  "org.opencontainers.image.url": "https://github.com/halkeye/Kavita",
  "org.opencontainers.image.version": "nightly"
}

@halkeye
Copy link
Author

halkeye commented Nov 23, 2024

example renovate output with and without the tags
image

@majora2007
Copy link
Member

I'm not able to grasp, outside the fork changes, what renovate is actually doing or why it's needed. @DieselTech please shine some light as well.

@halkeye
Copy link
Author

halkeye commented Nov 24, 2024

so https://docs.renovatebot.com/modules/datasource/docker/ is the docs for renovate. I'll admit i don't fully understand which labels they use, I do know the ones generated by the action work

Essentially they compare the labels on previous (or latest) and current tag to get the source location (this repo) and the ref (the tag), then it can use the github releases to match release notes and include them in the PR updating an image tag (with a fallback to just diff link if no release note).

I ->believe<- docker hub also will use these container labels to include links to the original repo in the sidebar, but i honestly havn't tested it.

Generally the opencontainer labels (which the docker action adds by default) just is a nice convention to follow and lots of tools can use them.

@halkeye
Copy link
Author

halkeye commented Nov 24, 2024

if you maintain a Docker image and want Renovate to find your changelogs, add a org.opencontainers.image.source field to your Dockerfile. The link must point to your GitHub or GitLab repository. Here's an example from our renovate/renovate Dockerfile:
LABEL org.opencontainers.image.source="https://github.com/renovatebot/renovate"

@majora2007
Copy link
Member

Okay, but I'm not sure why we need them on Kavita. I'm not understanding the value add. That's what I'm trying to grasp.

@halkeye
Copy link
Author

halkeye commented Nov 24, 2024

Its like adding og: meta tags to web sites. It allows machines easier time to get metadata. In my case, I use gitops so instead of using :latest, I use a specific tag, and renovate sends me a PR to update the tag. Its nice to have renovate also include the release notes directly in the PR so I don't have to goto this repo and find the release and the release notes.

I would suspect watchtower has something with docker labels too, i saw a dependancy, but i couldn't find where it might actually read it.

Just nice to have for consumers, it shouldn't affect kavita directly at all.

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

Successfully merging this pull request may close these issues.

2 participants