You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/installation/linux.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,6 +168,46 @@ sudo xbps-install -S hugo
168
168
169
169
{{% include "/_common/installation/04-build-from-source.md" %}}
170
170
171
+
## Docker container
172
+
173
+
### Prerequisites {#docker-prerequisites}
174
+
175
+
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].
176
+
177
+
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.
178
+
179
+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
180
+
181
+
```text
182
+
mkdir -p $HOME/.cache/hugo_cache
183
+
```
184
+
185
+
### Commands
186
+
187
+
To build your site using the latest version:
188
+
189
+
```sh {copy=true}
190
+
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
191
+
```
192
+
193
+
To build your site and start the embedded web server using the latest version:
194
+
195
+
```sh {copy=true}
196
+
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"
197
+
```
198
+
199
+
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:
200
+
201
+
```sh {copy=true}
202
+
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
203
+
```
204
+
205
+
### Cache directory
206
+
207
+
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.
208
+
209
+
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.
210
+
171
211
## Comparison
172
212
173
213
|Prebuilt binaries|Package managers|Repository packages|Build from source
@@ -186,6 +226,8 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|varies|:heavy_ch
Copy file name to clipboardExpand all lines: content/en/installation/macos.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,46 @@ sudo port install hugo
26
26
27
27
{{% include "/_common/installation/04-build-from-source.md" %}}
28
28
29
+
## Docker container
30
+
31
+
### Prerequisites {#docker-prerequisites}
32
+
33
+
Before running the Docker container locally you must install Docker Desktop. See the [installation instructions].
34
+
35
+
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.
36
+
37
+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
38
+
39
+
```text
40
+
mkdir -p $HOME/Library/Caches/hugo_cache
41
+
```
42
+
43
+
### Commands
44
+
45
+
To build your site using the latest version:
46
+
47
+
```sh {copy=true}
48
+
docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
49
+
```
50
+
51
+
To build your site and start the embedded web server using the latest version:
52
+
53
+
```sh {copy=true}
54
+
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"
55
+
```
56
+
57
+
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:
58
+
59
+
```sh {copy=true}
60
+
docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
61
+
```
62
+
63
+
### Cache directory
64
+
65
+
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.
66
+
67
+
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.
68
+
29
69
## Comparison
30
70
31
71
|Prebuilt binaries|Package managers|Build from source
@@ -40,3 +80,5 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mar
40
80
[^2]: Possible but requires advanced configuration.
Copy file name to clipboardExpand all lines: content/en/installation/windows.md
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,49 @@ go install -tags extended,withdeploy github.com/gohugoio/hugo@latest
130
130
> [!NOTE]
131
131
> See these [detailed instructions][] to install GCC on Windows.
132
132
133
+
## Docker container
134
+
135
+
> [!note]
136
+
> Run the commands in this section from [PowerShell] or a Linux terminal such as WSL or Git Bash. Do not use the Command Prompt.
137
+
138
+
### Prerequisites {#docker-prerequisites}
139
+
140
+
Before running the Docker container locally you must install Docker Desktop. See the [installation instructions].
141
+
142
+
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.
143
+
144
+
To prevent ownership and permission problems, create the Hugo [cache directory](#cache-directory) and ignore the error if the directory already exists:
145
+
146
+
```text
147
+
mkdir -f $Env:LocalAppData/hugo_cache
148
+
```
149
+
150
+
### Commands
151
+
152
+
To build your site using the latest version:
153
+
154
+
```sh {copy=true}
155
+
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache ghcr.io/gohugoio/hugo:latest build
156
+
```
157
+
158
+
To build your site and start the embedded web server using the latest version:
159
+
160
+
```sh {copy=true}
161
+
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"
162
+
```
163
+
164
+
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:
165
+
166
+
```sh {copy=true}
167
+
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache ghcr.io/gohugoio/hugo:v0.136.1 build
168
+
```
169
+
170
+
### Cache directory
171
+
172
+
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.
173
+
174
+
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.
175
+
133
176
## Comparison
134
177
135
178
|Prebuilt binaries|Package managers|Build from source
@@ -148,6 +191,9 @@ Latest version available?|:heavy_check_mark:|:heavy_check_mark:|:heavy_check_mar
0 commit comments