feat: build and push container image for ghcr.io, update docker.md, and other related fixes
I had some issues with the container and wanted to contrib the fixes back upstream. This has been tested to work on Fedora 39 and in GitHub Actions. Publishing an image on ghcr.io has no extra cost to you as the maintainer, but will make the life of users who prefer containers much easier.
See commits for more details. I'm also happy to answer questions.
Hey @xynydev, thank you very much for your effort, much appreciated! The thing is: The initial Docker MR already included external registry publishing, but only @lllyasviel can add secrets to this repository, and as he hasn't responded since we've added Docker support we'd need him to set Secrets up in the first place... So we're currently stuck here.
Hey @mashb1t, this PR doesn't require repository secrets, because it pushes to the GitHub Container Repository (ghcr), which every repository with GitHub Actions has access to by default, using the GitHub token the workflow is run with.
Hey @xynydev, I've actually never worked with Github actions to ghcr.io before, so thanks a lot for the explanation. The goal is only to build an image on releases tagged with versions (semver conform) and I'll have to do the switch from X.X.X to vX.X.X scheme to better distinguish version tags from other ones. Please double-check the changes.
The goal is only to build an image on releases tagged with versions (semver conform) and I'll have to do the switch from X.X.X to vX.X.X scheme to better distinguish version tags from other ones. Please double-check the changes.
Sounds great. I went ahead and merged your changes. I haven't used the semver option in the docker metadata action, but your suggestion looks alright. I'll see if I can do testing in my repo to validate that it works.
Aight, it worked: https://github.com/xynydev/Fooocus-fork/actions/runs/9194578288/job/25288353110 https://github.com/xynydev/Fooocus-fork/pkgs/container/fooocus-fork
The tag is 2.3.1 not v2.3.1, though. It might be possible to override that somehow, but everything works well enough now I guess.
Note that the current on: push: condition will only create a new container image when a new tag is created with a new commit in it. This would probably mean that the previous versions wouldn't get container images, only the next one. Also, if anyone has a reason to use an older image, they will get the one that was built that one time, without any fixes that might have been made upstream or in Fooocus' Dockerfile.
@xynydev thanks for testing, much appreciated! Tagging in docker with 2.3.1 is expected, git tag has to be v2.3.1 though.
Also, if anyone has a reason to use an older image, they will get the one that was built that one time, without any fixes that might have been made upstream or in Fooocus' Dockerfile.
This is also expected. Older images are not necessarily planned to be built, first one is the upcoming 2.4.0. Do you know if a tag on an existing commit will also trigger the pipeline? (this would be the preferred behavior)
From my testing, I'm not sure. I first created a tag on an existing commit and nothing happened. I then made a meaningles commit, pushed it, tagged it locally, and pushed the tag, and then it was triggered.
@xynydev just tested, the tag has to be on a branch where this change is already included, see https://github.com/mashb1t/Fooocus/actions/runs/9196855992/job/25296038248 Tagging and building older versions is consequently not possible, but also not needed.
I assume this is a personal issue but I'm getting this error with driver 555.85: RuntimeError: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 500: named symbol not found
May i ask which driver you're using? EDIT nvm, works with driver 552.44. Docker may need to add support for the latest driver.