docker安装gitbook
启动容器
[root@monitor ~]# docker run -d --name gitbook \
-p 4000:4000 \
-v /data/gitbook/gitbook:/srv/gitbook \
-v /data/gitbook/html:/srv/html \
fellah/gitbook
/srv/gitbook 是gitbook工作目录,用来存放源文件,映射到了本地的/data/gitbook/gitbook
/srv/html 是构建后的html文件,可在WEB服务中查看,映射到了本地的/data/gitbook/html
编辑核心文件
请确保本地的gitbook目录中包含至少README.md和SUMMARY.md两个文件
[root@monitor gitbook]# cat /data/gitbook/gitbook/SUMMARY.md
# Summary
* [Introduction](README.md)
* [Part I](part1/README.md)
* [Install Docker with CentOS8](part1/install_docker_with_centos8.md)
[root@monitor ~]# cat /data/gitbook/gitbook/README.md
# Introduction
[root@monitor gitbook]# tree /data/gitbook/ -L 3
/data/gitbook/
├── gitbook
│ ├── _book
│ │ ├── gitbook
│ │ ├── index.html
│ │ ├── part1
│ │ └── search_index.json
│ ├── part1
│ │ ├── install_docker_with_centos8.md
│ │ └── README.md
│ ├── README.md
│ └── SUMMARY.md
└── html
├── gitbook
│ ├── fonts
│ ├── gitbook.js
│ ├── gitbook-plugin-fontsettings
│ ├── gitbook-plugin-highlight
│ ├── gitbook-plugin-lunr
│ ├── gitbook-plugin-search
│ ├── gitbook-plugin-sharing
│ ├── images
│ ├── style.css
│ └── theme.js
├── index.html
├── part1
│ ├── index.html
│ └── install_docker_with_centos8.html
└── search_index.json
重新构建
每次改动md源文件后,都要重新构建,命令:
[root@monitor ~]# docker exec gitbook gitbook build . /srv/html