Contribute

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.

We assume that you already have basic skills about Git and Docker.

Fork Repository

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

Change Directory

And then change the current working directory to docker/hugo, the rest of steps are performed under this directory.

1cd hugo-docker/docker/hugo

Clone Hugo Repository

We need to clone Hugo into docker/hugo/src to build it from source.

1git clone -b <version> https://github.com/gohugoio/hugo src

Build Images

Modify files and save changes, and then build a local image, takes exts as an example.

1docker build -t myhugo-exts -f Dockerfile-exts .

Test Images

You should test the image locally to ensure it works properly.

1docker run -v ${PWD}:/src myhugo-exts hugo

Writing Tests

We strongly recommend writting tests on our build workflow if possible, so that we can make sure everything is fine before pushing it to registry.

If you’re unfimilar to this, skip this step for now, we will handle it on your PR.

Commit Changes

Once tests passed, you can commit the changes and push to remote.

1git add .
2git commit -m 'Write some meaningful message [build]'

Create Pull Request

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.