gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
73.49k stars 7.37k forks source link

ci: add image build #12573

Open morremeyer opened 3 weeks ago

morremeyer commented 3 weeks ago

Description

This adds a Docker image build running in GitHub actions for linux/amd64 and linux/arm64 images.

The build runs for every PR that changes either the workflow or the Dockerfile to verify the image still can be built correctly, but does not push the image for these runs.

For every tag, the images are built and pushed to the GitHub OCI registry.

Resolves #10760.

Testing

I have run tests with a slightly modified version (to enable testing) in my fork, see the test-add-image-build branch.

This builds the image with this workflow and results in the package being pushed to https://github.com/morremeyer/hugo/pkgs/container/hugo.

Continuous testing

I am aware of https://github.com/gohugoio/hugo/pull/8700#issuecomment-869981438 and happy to add automated testing of the images if there is a clear requirement for what should be tested.

However, as with the Dockerfile being a convenience, the same could also be applied to the resulting image in terms of guarantees.

CLAassistant commented 3 weeks ago

CLA assistant check
All committers have signed the CLA.

morremeyer commented 3 weeks ago

This is now ready for review, no more force-pushes here.

bep commented 2 weeks ago

@morremeyer thanks for this. I just wanted to chime in and say that I have seen this, and it looks good. I just need to think about this, as I'm a little stretched for time, and 1) A setup like this will eventually have to be updated/fixed when GitHub changes its API etc. and 2) This will open the gate for people wanting a more advanced Docerfile setup (e.g. Dart Sass, asciidoc etc. installs).