diff --git a/content/en/installation/bsd.md b/content/en/installation/bsd.md index a4f31bd5f9..9613888c00 100644 --- a/content/en/installation/bsd.md +++ b/content/en/installation/bsd.md @@ -20,8 +20,6 @@ Unless your specific deployment needs require the extended/deploy edition, we re Most BSD derivatives maintain a repository for commonly installed applications. Please note that these repositories may not contain the [latest release]. -[latest release]: https://github.com/gohugoio/hugo/releases/latest - ### DragonFly BSD [DragonFly BSD] includes Hugo in its package repository. To install the extended edition of Hugo: @@ -30,8 +28,6 @@ Most BSD derivatives maintain a repository for commonly installed applications. sudo pkg install gohugo ``` -[DragonFly BSD]: https://www.dragonflybsd.org/ - ### FreeBSD [FreeBSD] includes Hugo in its package repository. To install the extended edition of Hugo: @@ -40,8 +36,6 @@ sudo pkg install gohugo sudo pkg install gohugo ``` -[FreeBSD]: https://www.freebsd.org/ - ### NetBSD [NetBSD] includes Hugo in its package repository. To install the extended edition of Hugo: @@ -50,8 +44,6 @@ sudo pkg install gohugo sudo pkgin install go-hugo ``` -[NetBSD]: https://www.netbsd.org/ - ### OpenBSD [OpenBSD] includes Hugo in its package repository. This will prompt you to select which edition of Hugo to install: @@ -60,8 +52,6 @@ sudo pkgin install go-hugo doas pkg_add hugo ``` -[OpenBSD]: https://www.openbsd.org/ - {{% include "/_common/installation/04-build-from-source.md" %}} ## Comparison diff --git a/content/en/installation/linux.md b/content/en/installation/linux.md index babb759ea0..2c519c9469 100644 --- a/content/en/installation/linux.md +++ b/content/en/installation/linux.md @@ -172,6 +172,46 @@ sudo xbps-install -S hugo {{% include "/_common/installation/04-build-from-source.md" %}} +## Docker container + +### Prerequisites {#docker-prerequisites} + +Before running the Docker container locally you must install Docker Desktop or Docker Engine. See the installation instructions for either [Docker Desktop] or [Docker Engine]. + +When building your production site in a [CI/CD](g) workflow, whether you can run the Docker container depends on the service provider. For example, GitHub Pages and GitLab Pages allow you to run the Docker container. + +To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists: + +```text +mkdir -p $HOME/.cache/hugo_cache +``` + +### Commands + +To build your site using the latest version: + +```sh {copy=true} +docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build +``` + +To build your site and start the embedded web server using the latest version: + +```sh {copy=true} +docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0" +``` + +To use a specific version, in the commands above replace `latest` with any of the [tagged image versions]. For example, to build your site using v0.136.1: + +```sh {copy=true} +docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build +``` + +### Cache directory + +Attaching the host's Hugo cache directory to the container can significantly enhance performance, particularly for large and image-heavy sites. This allows Hugo to reuse previously generated content, reducing the need for repeated processing and transpilation. + +If you are using a custom Hugo cache directory, in the commands above replace `$HOME/.cache/hugo_cache` with the absolute path to your cache directory. + ## Comparison  |Prebuilt binaries|Package managers|Repository packages|Build from source @@ -190,6 +230,8 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_ch [Calculate Linux]: https://www.calculate-linux.org/ [CentOS]: https://www.centos.org/ [Debian]: https://www.debian.org/ +[Docker Desktop]: https://docs.docker.com/desktop/setup/install/linux/ +[Docker Engine]: https://docs.docker.com/engine/install/ [elementary OS]: https://elementary.io/ [EndeavourOS]: https://endeavouros.com/ [Exherbo]: https://www.exherbolinux.org/ @@ -212,6 +254,7 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_ch [Snap]: https://snapcraft.io/ [Solus]: https://getsol.us/ [strictly confined]: https://snapcraft.io/docs/snap-confinement +[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged [Ubuntu]: https://ubuntu.com/ [USE]: https://packages.gentoo.org/packages/www-apps/hugo [Void Linux]: https://voidlinux.org/ diff --git a/content/en/installation/macos.md b/content/en/installation/macos.md index 0f1fc0d277..ac1965ea04 100644 --- a/content/en/installation/macos.md +++ b/content/en/installation/macos.md @@ -28,10 +28,48 @@ Unless your specific deployment needs require the extended/deploy edition, we re sudo port install hugo ``` -[MacPorts]: https://www.macports.org/ - {{% include "/_common/installation/04-build-from-source.md" %}} +## Docker container + +### Prerequisites {#docker-prerequisites} + +Before running the Docker container locally you must install Docker Desktop. See the [installation instructions]. + +When building your production site in a [CI/CD](g) workflow, whether you can run the Docker container depends on the service provider. For example, GitHub Pages and GitLab Pages allow you to run the Docker container. + +To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists: + +```text +mkdir -p $HOME/Library/Caches/hugo_cache +``` + +### Commands + +To build your site using the latest version: + +```sh {copy=true} +docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build +``` + +To build your site and start the embedded web server using the latest version: + +```sh {copy=true} +docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0" +``` + +To use a specific version, in the commands above replace `latest` with any of the [tagged image versions]. For example, to build your site using v0.136.1: + +```sh {copy=true} +docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build +``` + +### Cache directory + +Attaching the host's Hugo cache directory to the container can significantly enhance performance, particularly for large and image-heavy sites. This allows Hugo to reuse previously generated content, reducing the need for repeated processing and transpilation. + +If you are using a custom Hugo cache directory, in the commands above replace `$HOME/Library/Caches/hugo_cache` with the absolute path to your cache directory. + ## Comparison  |Prebuilt binaries|Package managers|Build from source @@ -44,3 +82,7 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mar [^1]: Easy if a previous version is still installed. [^2]: Possible but requires advanced configuration. + +[installation instructions]: https://docs.docker.com/desktop/install/mac-install/ +[MacPorts]: https://www.macports.org/ +[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged diff --git a/content/en/installation/windows.md b/content/en/installation/windows.md index 0b7d89f6ed..7a1db6b23a 100644 --- a/content/en/installation/windows.md +++ b/content/en/installation/windows.md @@ -56,6 +56,49 @@ winget uninstall --name "Hugo (Extended)" > [!note] > See these [detailed instructions](https://discourse.gohugo.io/t/41370) to install GCC on Windows. +## Docker container + +> [!note] +> Run the commands in this section from [PowerShell] or a Linux terminal such as WSL or Git Bash. Do not use the Command Prompt. + +### Prerequisites {#docker-prerequisites} + +Before running the Docker container locally you must install Docker Desktop. See the [installation instructions]. + +When building your production site in a [CI/CD](g) workflow, whether you can run the Docker container depends on the service provider. For example, GitHub Pages and GitLab Pages allow you to run the Docker container. + +To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists: + +```text +mkdir -f $Env:LocalAppData/hugo_cache +``` + +### Commands + +To build your site using the latest version: + +```sh {copy=true} +docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build +``` + +To build your site and start the embedded web server using the latest version: + +```sh {copy=true} +docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0" +``` + +To use a specific version, in the commands above replace `latest` with any of the [tagged image versions]. For example, to build your site using v0.136.1: + +```sh {copy=true} +docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build +``` + +### Cache directory + +Attaching the host's Hugo cache directory to the container can significantly enhance performance, particularly for large and image-heavy sites. This allows Hugo to reuse previously generated content, reducing the need for repeated processing and transpilation. + +If you are using a custom Hugo cache directory, in the commands above replace `%LocalAppData%/hugo_cache` with the absolute path to your cache directory. + ## Comparison  |Prebuilt binaries|Package managers|Build from source @@ -70,5 +113,8 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mar [^2]: Easy if a previous version is still installed. [Chocolatey]: https://chocolatey.org/ +[installation instructions]: https://docs.docker.com/desktop/install/windows-install/ +[PowerShell]: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows [Scoop]: https://scoop.sh/ +[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged [Winget]: https://learn.microsoft.com/en-us/windows/package-manager/