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

Implement multiplatform builds #18

Merged
merged 4 commits into from
Oct 6, 2023

Conversation

Thanzex
Copy link
Contributor

@Thanzex Thanzex commented Oct 5, 2023

I changed the ghcr action as per Docker documentation to build docker images for multiple platforms in parallel.

The ARM images take considerably longer to build, as visible in my test run, but even for the free tier should be acceptable

@mgdigital mgdigital changed the base branch from main to docker-multiplatform October 6, 2023 07:31
@mgdigital
Copy link
Collaborator

mgdigital commented Oct 6, 2023

Thanks for this!

I've changed the branch target for this PR, just want to be doubly sure it works before it goes into main, and doesn't time out or anything.

The prettier check has failed. Are you able to fix this with prettier --write ., otherwise I can do that?

What would also be great is if we only added a latest tag when the tag name matches ^v\d+.\d+.\d+$, that would let us try out an alpha like v0.0.5-alpha.1. Looks to be possible as part of the metadata-action step: https://github.com/docker/metadata-action#latest-tag

@Thanzex
Copy link
Contributor Author

Thanzex commented Oct 6, 2023

Hi! I'll get right on that prettier check.

The version should be handled autmatically by the meta step, looking at the package output of my workflow run it added both a v0.0.4 and a latest tag.

Looking at the documentation, the default behaviour is to add tags for PR, branches, releases, all kinds of pushed tags and workflow dispatches, however it can be customized just like you pointed out.

If you'd like i'll update the workflow to handle versioning properly and give it a spin.

I opened this since I like to try all the selfhosted software I can find on my Pi4, and for this project creating a multiplatform image was fairly easy.

@mgdigital
Copy link
Collaborator

Thanks @Thanzex ,

Looking at the documentation, the default behaviour is to add tags for PR, branches, releases, all kinds of pushed tags and workflow dispatches, however it can be customized just like you pointed out.

I think what we want here is the semver config described here: https://github.com/docker/metadata-action#semver

So the expected tags would be:

Event Ref Docker Tags
push tag refs/tags/v1.2.3 1.2.3, 1.2, latest
push tag refs/tags/v2.0.8-beta.67 2.0.8-beta.67

@mgdigital mgdigital merged commit 73a6a5c into bitmagnet-io:docker-multiplatform Oct 6, 2023
6 checks passed
@Thanzex
Copy link
Contributor Author

Thanzex commented Oct 6, 2023

I ran a few test with this configuration and it seems to handle tags just ike you wanted.
latest is only added if the version is a standard semver, and i took the liberty of having it assign the full version and a v{major}.{minor}
which for a tag like v1.2.3 produces v1.2.3, v1.2 and latest

@mgdigital
Copy link
Collaborator

Thanks, just giving it a whirl now!

@Thanzex
Copy link
Contributor Author

Thanzex commented Oct 6, 2023

@mgdigital in the logs i see that the assigned tag is not v0.0.5-beta.1 but 0.0.5-beta.1, missing the v, which is weird considering I included it into the version.

I'll run a few more tests and see what's what

@mgdigital
Copy link
Collaborator

mgdigital commented Oct 6, 2023

i see that the assigned tag is not v0.0.5-beta.1 but 0.0.5-beta.1, missing the v, which is weird considering I included it into the version.

I think that's the effect of using the semver config. It strips out the v which I think is fine.

I've got a beta build running here, if that works I'll get it merged to main and do a latest release.

https://github.com/bitmagnet-io/bitmagnet/actions/runs/6432163848/job/17466443915

Thanks for your help

@Thanzex
Copy link
Contributor Author

Thanzex commented Oct 6, 2023

No problems!
I did a little test and adding prefix=v seems to do the trick, I added a commit that fixes it, you should see it here

@mgdigital
Copy link
Collaborator

Oh sorry right I see you added the v there. I think I'll just remove it on the other branch as having it without the v seems to be the convention for Docker tags.

@mgdigital
Copy link
Collaborator

Hmm so it has added the latest tag to that: https://github.com/bitmagnet-io/bitmagnet/pkgs/container/bitmagnet

I wonder if the v had anything to do with it. I'm gonna try again with another beta.

You weren't wrong about the build taking a long time!

mgdigital added a commit that referenced this pull request Oct 6, 2023
* Implement multiplatform builds (#18)

* Initial multiplatform build

* Change image name for pr

* Fix prettier errors

* Handle semver

---------

Co-authored-by: Francesco Bruno <f.bruno.dev@gmail.com>

* Avoid dirty version number

* Remove v prefix

* Add tags option

* Fix tags?

---------

Co-authored-by: Francesco Bruno <b.frenc@hotmail.it>
Co-authored-by: Francesco Bruno <f.bruno.dev@gmail.com>
mgdigital added a commit that referenced this pull request Oct 9, 2023
* Implement multiplatform builds (#18) (#20)

* Implement multiplatform builds (#18)

* Initial multiplatform build

* Change image name for pr

* Fix prettier errors

* Handle semver

---------

Co-authored-by: Francesco Bruno <f.bruno.dev@gmail.com>

* Avoid dirty version number

* Remove v prefix

* Add tags option

* Fix tags?

---------

Co-authored-by: Francesco Bruno <b.frenc@hotmail.it>
Co-authored-by: Francesco Bruno <f.bruno.dev@gmail.com>

* parsing uint from env variable (#26)

* Use torrent_contents.info_hash instead of torrent_contents.id in Torznab result (#30)

* Add nil check (#31)

* Fix error message re: meta info from any pers (#34)

Co-authored-by: mgdigital <mgdigital@users.noreply.github.com>

* `docker-compose` is deprecated, use `docker compose` (#32)

Co-authored-by: mgdigital <mgdigital@users.noreply.github.com>

* Update issue templates (#33)

* Update issue templates

---------

Co-authored-by: Francesco Bruno <b.frenc@hotmail.it>
Co-authored-by: Francesco Bruno <f.bruno.dev@gmail.com>
Co-authored-by: myyc <myyc@users.noreply.github.com>
Co-authored-by: Niklas <niklas.brunberg@cag.se>
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.

None yet

2 participants