Skip to content

Commit 558f512

Browse files
committed
Document usage of official Docker image
Closes #2727
1 parent f26ca04 commit 558f512

File tree

4 files changed

+215
-40
lines changed

4 files changed

+215
-40
lines changed

content/en/installation/bsd.md

+58-17
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ Unless your specific deployment needs require the extended/deploy edition, we re
2020

2121
Most BSD derivatives maintain a repository for commonly installed applications. Please note that these repositories may not contain the [latest release].
2222

23-
[latest release]: https://github.com/gohugoio/hugo/releases/latest
24-
2523
### DragonFly BSD
2624

2725
[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.
3028
sudo pkg install gohugo
3129
```
3230

33-
[DragonFly BSD]: https://www.dragonflybsd.org/
34-
3531
### FreeBSD
3632

3733
[FreeBSD] includes Hugo in its package repository. To install the extended edition of Hugo:
@@ -40,8 +36,6 @@ sudo pkg install gohugo
4036
sudo pkg install gohugo
4137
```
4238

43-
[FreeBSD]: https://www.freebsd.org/
44-
4539
### NetBSD
4640

4741
[NetBSD] includes Hugo in its package repository. To install the extended edition of Hugo:
@@ -50,8 +44,6 @@ sudo pkg install gohugo
5044
sudo pkgin install go-hugo
5145
```
5246

53-
[NetBSD]: https://www.netbsd.org/
54-
5547
### OpenBSD
5648

5749
[OpenBSD] includes Hugo in its package repository. This will prompt you to select which edition of Hugo to install:
@@ -60,16 +52,65 @@ sudo pkgin install go-hugo
6052
doas pkg_add hugo
6153
```
6254

63-
[OpenBSD]: https://www.openbsd.org/
64-
6555
{{% include "/_common/installation/04-build-from-source.md" %}}
6656

57+
## Docker container
58+
59+
### Prerequisites {#docker-prerequisites}
60+
61+
Before running the Docker container locally you must install Docker. See the [installation instructions].
62+
63+
When building your production site in a [CI/CD] 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.
64+
65+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
66+
67+
```text
68+
mkdir -p $HOME/.cache/hugo_cache
69+
```
70+
71+
### Commands
72+
73+
To build your site using the latest version:
74+
75+
```sh {copy=true}
76+
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
77+
```
78+
79+
To build your site and start the embedded web server using the latest version:
80+
81+
```sh {copy=true}
82+
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"
83+
```
84+
85+
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:
86+
87+
```sh {copy=true}
88+
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
89+
```
90+
91+
### Cache directory
92+
93+
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.
94+
95+
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.
96+
6797
## Comparison
6898

69-
||Prebuilt binaries|Repository packages|Build from source
70-
:--|:--:|:--:|:--:
71-
Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
72-
Easy to upgrade?|:heavy_check_mark:|varies|:heavy_check_mark:
73-
Easy to downgrade?|:heavy_check_mark:|varies|:heavy_check_mark:
74-
Automatic updates?|:x:|varies|:x:
75-
Latest version available?|:heavy_check_mark:|varies|:heavy_check_mark:
99+
||Prebuilt binaries|Repository packages|Build from source|Docker container
100+
|:--|:-:|:-:|:-:|:-:
101+
|Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:[^1]
102+
|Easy to upgrade?|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
103+
|Easy to downgrade?|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
104+
|Automatic updates?|:x:|varies|:x:|:x:
105+
|Latest version available?|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
106+
107+
[^1]: Docker containers do not require installation, but you must install Docker before you can run a container. See the [prerequisites](#docker-prerequisites) section above.
108+
109+
[DragonFly BSD]: https://www.dragonflybsd.org/
110+
[FreeBSD]: https://www.freebsd.org/
111+
[installation instructions]: https://wiki.freebsd.org/Docker
112+
[latest release]: https://github.com/gohugoio/hugo/releases/latest
113+
[NetBSD]: https://www.netbsd.org/
114+
[OpenBSD]: https://www.openbsd.org/
115+
[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged
116+
[CI/CD]: https://en.wikipedia.org/wiki/CI/CD

content/en/installation/linux.md

+51-7
Original file line numberDiff line numberDiff line change
@@ -156,24 +156,67 @@ sudo xbps-install -S hugo
156156

157157
{{% include "/_common/installation/04-build-from-source.md" %}}
158158

159+
## Docker container
160+
161+
### Prerequisites {#docker-prerequisites}
162+
163+
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].
164+
165+
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.
166+
167+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
168+
169+
```text
170+
mkdir -p $HOME/.cache/hugo_cache
171+
```
172+
173+
### Commands
174+
175+
To build your site using the latest version:
176+
177+
```sh {copy=true}
178+
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
179+
```
180+
181+
To build your site and start the embedded web server using the latest version:
182+
183+
```sh {copy=true}
184+
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"
185+
```
186+
187+
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:
188+
189+
```sh {copy=true}
190+
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
191+
```
192+
193+
### Cache directory
194+
195+
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.
196+
197+
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.
198+
159199
## Comparison
160200

161-
||Prebuilt binaries|Package managers|Repository packages|Build from source
162-
:--|:--:|:--:|:--:|:--:
163-
Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
164-
Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:
165-
Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|varies|:heavy_check_mark:
166-
Automatic updates?|:x:|varies [^2]|:x:|:x:
167-
Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:
201+
||Prebuilt binaries|Package managers|Repository packages|Build from source|Docker container
202+
|:--|:-:|:-:|:-:|:-:|:-:
203+
|Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:[^3]
204+
|Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
205+
|Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|varies|:heavy_check_mark:|:heavy_check_mark:
206+
|Automatic updates?|:x:|varies [^2]|:x:|:x:|:x:
207+
|Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_check_mark:|:heavy_check_mark:
168208

169209
[^1]: Easy if a previous version is still installed.
170210
[^2]: Snap packages are automatically updated. Homebrew requires advanced configuration.
211+
[^3]: Docker containers do not require installation, but you must install Docker Desktop or Docker Engine before you can run a container. See the [prerequisites](#docker-prerequisites) section above.
171212

172213
[Alpine Linux]: https://alpinelinux.org/
173214
[Arch Linux]: https://archlinux.org/
174215
[Calculate Linux]: https://www.calculate-linux.org/
175216
[CentOS]: https://www.centos.org/
176217
[Debian]: https://www.debian.org/
218+
[Docker Desktop]: https://docs.docker.com/desktop/setup/install/linux/
219+
[Docker Engine]: https://docs.docker.com/engine/install/
177220
[elementary OS]: https://elementary.io/
178221
[EndeavourOS]: https://endeavouros.com/
179222
[Exherbo]: https://www.exherbolinux.org/
@@ -196,6 +239,7 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_ch
196239
[Snap]: https://snapcraft.io/
197240
[Solus]: https://getsol.us/
198241
[strictly confined]: https://snapcraft.io/docs/snap-confinement
242+
[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged
199243
[Ubuntu]: https://ubuntu.com/
200244
[USE]: https://packages.gentoo.org/packages/www-apps/hugo
201245
[Void Linux]: https://voidlinux.org/

content/en/installation/macos.md

+52-9
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,62 @@ Unless your specific deployment needs require the extended/deploy edition, we re
2828
sudo port install hugo
2929
```
3030

31-
[MacPorts]: https://www.macports.org/
32-
3331
{{% include "/_common/installation/04-build-from-source.md" %}}
3432

33+
## Docker container
34+
35+
### Prerequisites {#docker-prerequisites}
36+
37+
Before running the Docker container locally you must install Docker Desktop. See the [installation instructions].
38+
39+
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.
40+
41+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
42+
43+
```text
44+
mkdir -p $HOME/Library/Caches/hugo_cache
45+
```
46+
47+
### Commands
48+
49+
To build your site using the latest version:
50+
51+
```sh {copy=true}
52+
docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
53+
```
54+
55+
To build your site and start the embedded web server using the latest version:
56+
57+
```sh {copy=true}
58+
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"
59+
```
60+
61+
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:
62+
63+
```sh {copy=true}
64+
docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
65+
```
66+
67+
### Cache directory
68+
69+
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.
70+
71+
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.
72+
3573
## Comparison
3674

37-
||Prebuilt binaries|Package managers|Build from source
38-
:--|:--:|:--:|:--:
39-
Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
40-
Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
41-
Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|:heavy_check_mark:
42-
Automatic updates?|:x:|:x: [^2]|:x:
43-
Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
75+
||Prebuilt binaries|Package managers|Build from source|Docker container
76+
|:--|:-:|:-:|:-:|:-:
77+
|Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:[^3]
78+
|Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
79+
|Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^1]|:heavy_check_mark:|:heavy_check_mark:
80+
|Automatic updates?|:x:|:x: [^2]|:x:|:x:
81+
|Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
4482

4583
[^1]: Easy if a previous version is still installed.
4684
[^2]: Possible but requires advanced configuration.
85+
[^3]: Docker containers do not require installation, but you must install Docker Desktop before you can run a container. See the [prerequisites](#docker-prerequisites) section above.
86+
87+
[installation instructions]: https://docs.docker.com/desktop/install/mac-install/
88+
[MacPorts]: https://www.macports.org/
89+
[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged

content/en/installation/windows.md

+54-7
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,66 @@ winget uninstall --name "Hugo (Extended)"
5656
> [!note]
5757
> See these [detailed instructions](https://discourse.gohugo.io/t/41370) to install GCC on Windows.
5858
59+
## Docker container
60+
61+
> [!note]
62+
> Run the commands in this section from [PowerShell] or a Linux terminal such as WSL or Git Bash. Do not use the Command Prompt.
63+
64+
### Prerequisites {#docker-prerequisites}
65+
66+
Before running the Docker container locally you must install Docker Desktop. See the [installation instructions].
67+
68+
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.
69+
70+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
71+
72+
```text
73+
mkdir -f $Env:LocalAppData/hugo_cache
74+
```
75+
76+
### Commands
77+
78+
To build your site using the latest version:
79+
80+
```sh {copy=true}
81+
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
82+
```
83+
84+
To build your site and start the embedded web server using the latest version:
85+
86+
```sh {copy=true}
87+
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"
88+
```
89+
90+
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:
91+
92+
```sh {copy=true}
93+
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
94+
```
95+
96+
### Cache directory
97+
98+
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.
99+
100+
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.
101+
59102
## Comparison
60103

61-
||Prebuilt binaries|Package managers|Build from source
62-
:--|:--:|:--:|:--:
63-
Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|
64-
Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
65-
Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^2]|:heavy_check_mark:
66-
Automatic updates?|:x:|:x: [^1]|:x:
67-
Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
104+
||Prebuilt binaries|Package managers|Build from source|Docker container
105+
|:--|:-:|:-:|:-:|:-:
106+
|Easy to install?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:[^3]
107+
|Easy to upgrade?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
108+
|Easy to downgrade?|:heavy_check_mark:|:heavy_check_mark: [^2]|:heavy_check_mark:|:heavy_check_mark:
109+
|Automatic updates?|:x:|:x: [^1]|:x:|:x:
110+
|Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mark:
68111

69112
[^1]: Possible but requires advanced configuration.
70113
[^2]: Easy if a previous version is still installed.
114+
[^3]: Docker containers do not require installation, but you must install Docker Desktop before you can run a container. See the [prerequisites](#docker-prerequisites) section above.
71115

72116
[Chocolatey]: https://chocolatey.org/
117+
[installation instructions]: https://docs.docker.com/desktop/install/windows-install/
118+
[PowerShell]: https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows
73119
[Scoop]: https://scoop.sh/
120+
[tagged image versions]: https://github.com/gohugoio/hugo/pkgs/container/hugo/versions?filters%5Bversion_type%5D=tagged
74121
[Winget]: https://learn.microsoft.com/en-us/windows/package-manager/

0 commit comments

Comments
 (0)