We're glad to see developers who want to contribute to this project, in this section, you'll learn how to build and test images on local environment, and then commit changes to our repository.
Become a backer or sponsor to support our work.
We assume that you already have basic skills about Git and Docker.
Firstly, you should fork the repository, and then clone it to local. Assume that the https://github.com/username/hugo-docker
is the fork repository.
1git clone https://github.com/username/hugo-docker hugo-docker
And then change the current working directory to docker/hugo
, the rest of steps are performed under this directory.
1cd hugo-docker/docker/hugo
We need to clone Hugo into docker/hugo/src
to build it from source.
1git clone -b <version> https://github.com/gohugoio/hugo src
Please replace the <version>
with particular version, such as v0.126.1
.
Modify files and save changes, and then build a local image, takes exts
as an example.
1docker build -t myhugo-exts -f Dockerfile-exts .
You should test the image locally to ensure it works properly.
1docker run -v ${PWD}:/src myhugo-exts hugo
We strongly recommend writing tests on our build workflow if possible, so that we can make sure everything is fine before pushing it to registry.
If you’re unfamiliar to this, skip this step for now, we will handle it on your PR.
Once tests passed, you can commit the changes and push to remote.
1git add .
2git commit -m 'Write some meaningful message [build]'
[build]
is required to trigger the build workflow.
To create a pull request, you can simply navigate to your fork repository, then GitHub web UI will pop up a button to create pull request. We will review and merge it after the tests are passed.