@@ -17,6 +17,7 @@ For my personal use I make smaller the image of _publysher_ because I use it in
17
17
18
18
The image is based on the following directory structure:
19
19
20
+ ``` txt
20
21
.
21
22
├── Dockerfile
22
23
└── site
@@ -27,16 +28,21 @@ The image is based on the following directory structure:
27
28
│ └── ...
28
29
└── static
29
30
└── ...
31
+ ```
30
32
31
33
In other words, your Hugo site resides in the ` site ` directory, and you have a simple Dockerfile:
32
34
33
- FROM fundor333/hugo
35
+ ``` dockerfile
36
+ FROM fundor333/hugo
37
+ ```
34
38
35
39
## Building your site
36
40
37
41
Based on this structure, you can easily build an image for your site:
38
42
39
- docker build -t my/image .
43
+ ``` sh
44
+ docker build -t my/image .
45
+ ```
40
46
41
47
Your site is automatically generated during this build.
42
48
@@ -49,15 +55,21 @@ There are two options for using the image you generated:
49
55
50
56
Using your image as a stand-alone image is the easiest:
51
57
52
- docker run -p 1313:1313 my/image
58
+ ``` sh
59
+ docker run -p 1313:1313 my/image
60
+ ```
53
61
54
62
This will automatically start ` hugo server ` , and your blog is now available on < http://localhost:1313 > .
55
63
56
64
If you are using ` boot2docker ` , you need to adjust the base URL:
57
65
58
- docker run -p 1313:1313 -e HUGO_BASE_URL=http://YOUR_DOCKER_IP:1313 my/image
66
+ ``` sh
67
+ docker run -p 1313:1313 -e HUGO_BASE_URL=http://YOUR_DOCKER_IP:1313 my/image
68
+ ```
59
69
60
70
The image is also suitable for use as a volume image for a web server, such as [ nginx] ( https://registry.hub.docker.com/_/nginx/ )
61
71
62
- docker run -d -v /usr/share/nginx/html --name site-data my/image
63
- docker run -d --volumes-from site-data --name site-server -p 80:80 nginx
72
+ ``` sh
73
+ docker run -d -v /usr/share/nginx/html --name site-data my/image
74
+ docker run -d --volumes-from site-data --name site-server -p 80:80 nginx
75
+ ```
0 commit comments