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

Rewrote build and push pipeline to accomodate ghcr.io, build in parallel #33

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tenekev
Copy link

@tenekev tenekev commented Jan 5, 2025

I noticed the build & push workflow is a bit lacking. I added an option to push both for Docker Hub and GHCR.io as the native Container Registry.

  • The workflow pushes to Docker Hub only if DOCKER_USERNAME is specified, otherwise it's skipped. The push to GHCR.io is native.
  • You might need to review your repo settings - Settings > Actions > General in order to run & push to GHCR.io.
  • Once the image is published, it can be found in the Packages section of the repo. You might need to change the accessibility settings of the image to make it public but it should inherit the accessibility from the repo.

⚠️WARNING: DOCKER_PASSWORD secret was changed to DOCKER_TOKEN for accuracy. Docker Hub should be used with tokens. Update the secret's name.

@clusterzx
Copy link
Owner

Thank you for your work, I really appriciate that! I am not that much of a DevOps (CI/CD) Guy 😆
I will look into it later and get back to you.

@tenekev
Copy link
Author

tenekev commented Jan 5, 2025

I'm not a professional (yet), so take it with a grain of salt. The only opinionated thing is the preference to GHCR.io. The rest should work like the old pipeine. I haven't tested with different branches.

@ilijamt
Copy link

ilijamt commented Jan 6, 2025

Can you also add linux/arm64 to the build process?
I use it on linux/arm64 so it works perfectly there as well.

@pixil98
Copy link

pixil98 commented Jan 7, 2025

I should read things before I post. To make this post still useful, I'll just let @ilijamt know that this is adding support for building linux/arm64.

@clusterzx
Copy link
Owner

I will merge this today. @tenekev thanks again for you work, really appreciate it.

@clusterzx clusterzx mentioned this pull request Jan 7, 2025
Copy link

@rafaribe rafaribe left a comment

Choose a reason for hiding this comment

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

Why complicate with the matrix approach? This will indeed build them in parallel, but it will build two images with different sha256 with effectively the same content, why not do something like this:

https://github.com/rafaribe/paperless-ai/blob/main/.github/workflows/docker-build-push.yml

It will build once, tag twice, with the same sha and push to both GHCR and Dockerhub.

I would agree to keep ubuntu-24.04 and package permissions and the rest of the steps.

@clusterzx
Copy link
Owner

Can you revert DOCKER_TOKEN to DOCKER_PASSWORD as this is just naming. There is a token behind it ?
Also where do I generate the token for ghcr? :)

@tenekev
Copy link
Author

tenekev commented Jan 10, 2025

The Docker hub token can be generated from the docker hub interface. https://app.docker.com/settings/personal-access-tokens

The GitHub token should be accessible inside the workflow without any extra work from you.

@clusterzx
Copy link
Owner

Ah sorry dunno why I added a questionmark at the end behind "There is a token behind it". I wanted to say THERE IS a token behind it already. I just did a non normal name coversion for that. xD

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.

5 participants