From 8be11b00a3a84edbdf87afe22497cd5ac55d1bb9 Mon Sep 17 00:00:00 2001 From: Martyn Welch <martyn.welch@collabora.com> Date: Thu, 4 Mar 2021 15:58:57 +0000 Subject: [PATCH] Add basic run script, update used docker image and document We have been using an old version of hugo in the gitlab registry as the latest version available at the time this was setup had a show stopping bug. Update the version of hugo used and switch to the docker image recommended by the Hugo project as this is potentially easier for those behind restrictive proxies to access. Provide a helper script to also make it easier to run Hugo from docker as a developer and document it. Use the `--rm` option to cause docker to remove the container once it's exited to avoid them building up and add `--security-opt label=disable` for those using an SELinux enabled distribution. Signed-off-by: Martyn Welch <martyn.welch@collabora.com> --- .gitlab-ci.yml | 10 +++------- README.md | 12 +++--------- run_hugo.sh | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 16 deletions(-) create mode 100755 run_hugo.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ef584b9b..eceddfe18 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,3 @@ -# All available Hugo versions are listed here: https://gitlab.com/pages/hugo/container_registry -#image: registry.gitlab.com/pages/hugo:latest - -# Locking to v0.62.2 for now - hit by bug, 0.63.2 not available yet with fix: -# https://github.com/gohugoio/hugo/issues/6805 - variables: GIT_SUBMODULE_STRATEGY: recursive @@ -12,7 +6,9 @@ stages: - generate-pdf test-html: - image: registry.gitlab.com/pages/hugo:0.62.2 + image: + name: klakegg/hugo:latest + entrypoint: [""] stage: generate-html tags: - lightweight diff --git a/README.md b/README.md index 2d2658e58..aa9a98b84 100644 --- a/README.md +++ b/README.md @@ -132,15 +132,9 @@ defined in [`.gitlab-ci.yml`](.gitlab-ci.yml). ## Building locally -To work locally with this project, you'll have to follow the steps below: - -1. Fork, clone or download this project -1. [Install][https://gohugo.io/overview/installing/] Hugo -1. Preview your project: `hugo server` -1. Add content -1. Generate the website: `hugo` (optional) - -Read more at Hugo's [documentation][https://gohugo.io/overview/introduction/]. +The `run_hugo.sh` script is provided to run Hugo from docker. Running this +script will generate the site, running `./run_hugo.sh server` will serve the +site locally on `http://localhost:1313`. ### Preview your site diff --git a/run_hugo.sh b/run_hugo.sh new file mode 100755 index 000000000..68ac407d4 --- /dev/null +++ b/run_hugo.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +REPO=$(dirname $(realpath $0)) + +docker run \ + --rm \ + -p 1313:1313/tcp \ + -w /source \ + -u $(id -u) \ + -v ${REPO}:/source \ + --security-opt label=disable \ + klakegg/hugo:latest \ + $@ + -- GitLab