Ghcr push workflow#14
Conversation
|
Also, wanted to add caching to the workflow- was thinking about it since the Docassemble docker file is pretty heavy(lots of python packages, NLTK downlaods, pandoc, etc). Without caching every build starts from scratch which could take some time. So the idea is to use inline registry cache since we're already pushing to GHCR anyway - cache gets stored in the image itself and reused on the next build. Just the two lines to add: References I looked at:
Not a blocker for the PR, just thought it was worth adding. |
BryceStevenWilley
left a comment
There was a problem hiding this comment.
Looks good to me! I don't think we'll need to run on pull requests (mostly because most won't be targeting master).
I'll make that change and maybe retarget the PR to a new branch. There will have to be a lot of copying of commits around.
* Added action workflow to build and push docker image to GHCR * Remove pull_request target
Follow up to #14. Added inline registry caching to the build step. With this, docker uses reused unchanged layers from the last pushed image, so only the changed parts gets rebuilt again.
Follow up to #14. Added inline registry caching to the build step. With this, docker uses reused unchanged layers from the last pushed image, so only the changed parts gets rebuilt again.
* Added action workflow to build and push docker image to GHCR * Remove pull_request target
* Added action workflow to build and push docker image to GHCR * Remove pull_request target Add support for multiple platforms in Docker build Linux amd64 was supported by default, but for newer Macs, arm64 is useful to have. Otherwise, we get a warning: ``` WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested ```
What this does:
Builds on every push to master and every PR (to catch broken Dockerfiles early)
Only pushes to GHCR on tagged releases - same pattern as the Python packages
Tags the image with the version number and commit SHA so we can trace and roll back any build
All third party actions are pinned to commit SHAs instead of floating tags
References:
https://github.com/docker/login-action
https://github.com/docker/metadata-action
https://github.com/docker/build-push-action
https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry