Skip to content

fix(#33711): cross-publish docker images to ghcr.io #34148

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

Merged
merged 2 commits into from
Apr 10, 2025

Conversation

a1994sc
Copy link
Contributor

@a1994sc a1994sc commented Apr 8, 2025

This PR will cross-publish the release, rc, and nightly images from docker.io to ghcr.io as docker hub has imposed rate-limiting

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 8, 2025
@techknowlogick
Copy link
Member

Not sure if you saw this https://blog.gitea.com/docker-registry-update/ but you don't need to use docker.io URLs and it allows us to not have to be tied to yet another provider

@a1994sc
Copy link
Contributor Author

a1994sc commented Apr 8, 2025

I did not.... I still think that cross-posting to ghcr.io would be a good idea, but I would understand if you don't want too

@techknowlogick
Copy link
Member

Oh no worries. I agree that this is probably still feasible. The workflow might need the permissions block to be added so that the token can have package push permissions.
Thanks for this PR btw:)

@a1994sc
Copy link
Contributor Author

a1994sc commented Apr 8, 2025

Oh..... Yes, I will update the PR soon; thanks for the sanity check

@lunny
Copy link
Member

lunny commented Apr 8, 2025

I couldn't find a reason to use another provider after we cache it ourselves.

@a1994sc a1994sc force-pushed the feat/publish-ghcr-io branch from 3db8331 to 9807d69 Compare April 8, 2025 02:32
@a1994sc
Copy link
Contributor Author

a1994sc commented Apr 8, 2025

At least for myself, at my org we have limited access to which container registries we are allowed to pull from; so having the same images cross-posted to both docker hub and github allows us to avoid the rate limiting.

Comment on lines 106 to 109
- name: copy rootful docker image to ghcr.io
# this will also copy both the amd64 and arm64 versions at the same time
run: |-
oras cp --recursive docker.io/gitea/gitea:${{ steps.meta.outputs.tags }} ghcr.io/gitea/gitea:${{ steps.meta.outputs.tags }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why introduce another dependency to the workflow if docker-build-push can already push to multiple locations?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. I was not aware it could do that, I can update the logic this evening, thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the PR to remove the oras dependency and used the docker/metadata-action action to push both to docker hub and ghcr

@lunny
Copy link
Member

lunny commented Apr 8, 2025

https://blog.gitea.com/docker-registry-update/

The rate limitation of docker hub has been resolved, ref https://blog.gitea.com/docker-registry-update/

@a1994sc a1994sc force-pushed the feat/publish-ghcr-io branch from 10cc6b9 to 34f4c62 Compare April 8, 2025 22:49
@techknowlogick
Copy link
Member

@lunny yup, I linked the blog post above, but this user is facing an issue where only a few public registries are on their network allow list.
Publishing to ghcr would allow others in a similar situation to fetch our image too. It makes sense that adding a registry for just one image might be too much overhead for each and every application that might have their own registry.
We'd probably have to make sure not to add it in our docs in case too many people rely on it and we need to deprecate it.

@a1994sc
Copy link
Contributor Author

a1994sc commented Apr 8, 2025

Personally I think that it helps adoption to have the image in the major container registries, docker.io / ghcr.io / quay.io, as people may have easier access to one over the others.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 10, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 10, 2025
@techknowlogick techknowlogick enabled auto-merge (squash) April 10, 2025 19:13
@techknowlogick techknowlogick added topic/distribution This PR changes something about the packaging of Gitea skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. backport/v1.23 This PR should be backported to Gitea 1.23 labels Apr 10, 2025
@techknowlogick techknowlogick merged commit 4a3ab5a into go-gitea:main Apr 10, 2025
26 checks passed
@GiteaBot GiteaBot added this to the 1.25.0 milestone Apr 10, 2025
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Apr 10, 2025
@lunny lunny modified the milestones: 1.25.0, 1.24.0 Apr 10, 2025
@a1994sc
Copy link
Contributor Author

a1994sc commented Apr 10, 2025

@techknowlogick you will need to change the visibility of the package to public for users to be able to pull the image:

https://docs.github.com/en/packages/learn-github-packages/configuring-a-packages-access-control-and-visibility#configuring-visibility-of-packages-for-an-organization

@a1994sc
Copy link
Contributor Author

a1994sc commented Apr 10, 2025

Thank you very much for merging this in

GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Apr 11, 2025
…#34148)

This PR will cross-publish the release, rc, and nightly images from
`docker.io` to `ghcr.io` as docker hub has imposed rate-limiting

Signed-off-by: Allen Conlon <[email protected]>
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Apr 11, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 14, 2025
* giteaofficial/main: (27 commits)
  fix github migration error when using multiple tokens (go-gitea#34144)
  Add package version api endpoints (go-gitea#34173)
  Fix incorrect file links (go-gitea#34189)
  Add cache for common package queries (go-gitea#22491)
  Allow admins and org owners to change org member public status (go-gitea#28294)
  Fix span svg layout (go-gitea#34185)
  fix webhook url (go-gitea#34186)
  Optimize overflow-menu (go-gitea#34183)
  Move and rename UpdateRepository (go-gitea#34136)
  Update milestones.tmpl (go-gitea#34184)
  [skip ci] Updated translations via Crowdin
  Refactor Git Attribute & performance optimization (go-gitea#34154)
  [skip ci] Updated translations via Crowdin
  fix(go-gitea#33711): cross-publish docker images to ghcr.io (go-gitea#34148)
  refactor organization menu (go-gitea#33928)
  feat: Add sorting by exclusive labels (issue priority) (go-gitea#33206)
  Fix vertical centering of file tree icons and use entryIcon for submodules/symlinks (go-gitea#34137)
  bugfix check for alternate ssh host certificate location (go-gitea#34146)
  Cache GPG keys, emails and users when list commits (go-gitea#34086)
  Set MERMAID_MAX_SOURCE_CHARACTERS to 50000 (go-gitea#34152)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/done All backports for this PR have been created backport/v1.23 This PR should be backported to Gitea 1.23 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/internal skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. topic/distribution This PR changes something about the packaging of Gitea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants