1. 创建 docker-compose.yml
在 /data/hugo
下
name: hugo-server
services:
hugo-server:
image: hugomods/hugo:exts
container_name: hugo-server
command: new site /src
# command: server -D
volumes:
- ./site:/src
ports:
- 1313:1313
2. 执行docker compose前台命令,初始化完成,自然退出
docker compose up
3. 修改docker-compose.yml,将command: server -D
放开,将command: new site /src
注释
name: hugo-server
services:
hugo-server:
image: hugomods/hugo:exts
container_name: hugo-server
# command: new site /src
command: server -D
volumes:
- ./site:/src
ports:
- 1313:1313
4. 再执行docker compose 命令后台运行
docker compose up -d
5. 使用MEME
主题,git初始化主题
cd /data/hugo/site
git init
git submodule add --depth 1 https://github.com/reuixiy/hugo-theme-meme.git themes/meme
6. 将 hugo.toml
替换为MEME配置
rm hugo.toml && cp themes/meme/config-examples/zh-cn/config.toml hugo.toml
7. 新建一篇文章和一个关于页面
docker exec -it hugo-server /bin/sh
hugo new "posts/hello-world.md"
hugo new "about/_index.md"
8. 访问localhost:1313