Gitbook的docker安装配置
-
创建目录:/gitbook/gitbook 和 /gitbook/html
-
docker安装gitbook
docker run --name gitbook -p 4000:4000 -v /gitbook/gitbook:/srv/gitbook -v /gitbook/html:/srv/html fellah/gitbook
-
初始化gitbook
[root@it gitbook]# docker exec gitbook gitbook init
warn: no summary file in this book info: create SUMMARY.md info: initialization is finished
[root@it gitbook]# ls _book README.md SUMMARY.md
- 每次改动md源文件后,都要重新构建,命令:
[root@it gitbook]# docker exec gitbook gitbook build . /srv/html
info: 7 plugins are installed info: 6 explicitly listed info: loading plugin "highlight"... OK info: loading plugin "search"... OK info: loading plugin "lunr"... OK info: loading plugin "sharing"... OK info: loading plugin "fontsettings"... OK info: loading plugin "theme-default"... OK info: found 1 pages info: found 0 asset files info: >> generation finished with success in 0.9s !
[root@it gitbook]#
- 升级gitbook,首先进入docker bash,apt install git
[root@it gitbook]# docker exec -it 54dca0894540 sh # apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://httpredir.debian.org jessie InRelease
Get:2 http://httpredir.debian.org jessie-updates InRelease [16.3 kB]
Get:3 http://httpredir.debian.org jessie Release.gpg [1652 B]
Get:4 http://httpredir.debian.org jessie Release [77.3 kB]
Get:5 http://security.debian.org jessie/updates/main amd64 Packages [992 kB]
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [20 B]
Get:7 http://httpredir.debian.org jessie/main amd64 Packages [9098 kB]
Fetched 10.2 MB in 15s (671 kB/s)
Reading package lists... Done
W: There is no public key available for the following key IDs:
AA8E81B4331F7F50 # apt install git
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
git-man less libalgorithm-c3-perl libarchive-extract-perl libbsd0 libcgi-fast-perl libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl libcurl3-gnutls libdata-optlist-perl libdata-section-perl libedit2
liberror-perl libexpat1 libfcgi-perl libgdbm3 liblog-message-perl liblog-message-simple-perl libmodule-build-perl libmodule-pluggable-perl libmodule-signature-perl libmro-compat-perl libpackage-constants-perl libparams-util-perl libpod-latex-perl libpod-readme-perl libpopt0 libregexp-common-perl libsoftware-license-perl libsub-exporter-perl libsub-install-perl libterm-ui-perl libtext-soundex-perl libtext-template-perl libx11-6 libx11-data libxau6 libxcb1
libxdmcp6 libxext6 libxmuu1 openssh-client patch perl perl-base perl-modules rename rsync xauth
Suggested packages:
gettext-base git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn ssh-askpass libpam-ssh keychain monkeysphere ed diffutils-doc perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl make libb-lint-perl libcpanplus-dist-build-perl libcpanplus-perl libfile-checktree-perl libobject-accessor-perl openssh-server
Recommended packages: ssh-client libarchive-tar-perl The following NEW packages will be installed:
git git-man less libalgorithm-c3-perl libarchive-extract-perl libbsd0 libcgi-fast-perl libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcpan-meta-perl libcurl3-gnutls libdata-optlist-perl libdata-section-perl libedit2
liberror-perl libexpat1 libfcgi-perl libgdbm3 liblog-message-perl liblog-message-simple-perl libmodule-build-perl libmodule-pluggable-perl libmodule-signature-perl libmro-compat-perl libpackage-constants-perl libparams-util-perl libpod-latex-perl libpod-readme-perl libpopt0 libregexp-common-perl libsoftware-license-perl libsub-exporter-perl libsub-install-perl libterm-ui-perl libtext-soundex-perl libtext-template-perl libx11-6 libx11-data libxau6 libxcb1
libxdmcp6 libxext6 libxmuu1 openssh-client patch perl perl-modules rename rsync xauth
The following packages will be upgraded: perl-base 1 upgraded, 51 newly installed, 0 to remove and 68 not upgraded.
Need to get 15.3 MB of archives.
After this operation, 72.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://httpredir.debian.org/debian/ jessie/main libgdbm3 amd64 1.8.3-13.1 [30.0 kB]
Get:2 http://httpredir.debian.org/debian/ jessie/main libpopt0 amd64 1.16-10 [49.2 kB]
Get:3 http://httpredir.debian.org/debian/ jessie/main libedit2 amd64 3.1-20140620-2 [85.1 kB]
Get:4 http://httpredir.debian.org/debian/ jessie/main libxau6 amd64 1:1.0.8-1 [20.7 kB]
Get:5 http://security.debian.org/ jessie/updates/main perl-base amd64 5.20.2-3+deb8u12 [1231 kB]
Get:6 http://httpredir.debian.org/debian/ jessie/main libxcb1 amd64 1.10-3+b1 [44.4 kB]
Get:7 http://httpredir.debian.org/debian/ jessie/main libxext6 amd64 2:1.3.3-1 [52.7 kB]
Get:8 http://httpredir.debian.org/debian/ jessie/main libxmuu1 amd64 2:1.1.2-1 [23.3 kB]
Get:9 http://httpredir.debian.org/debian/ jessie/main less amd64 458-3 [124 kB]
Get:10 http://httpredir.debian.org/debian/ jessie/main liberror-perl all 0.17-1.1 [22.4 kB]
Get:11 http://httpredir.debian.org/debian/ jessie/main libalgorithm-c3-perl all 0.09-1 [11.9 kB]
Get:12 http://httpredir.debian.org/debian/ jessie/main libarchive-extract-perl all 0.72-1 [24.8 kB]
Get:13 http://httpredir.debian.org/debian/ jessie/main libcgi-pm-perl all 4.09-1 [213 kB]
Get:14 http://httpredir.debian.org/debian/ jessie/main libfcgi-perl amd64 0.77-1+deb8u1 [39.0 kB]
Get:15 http://httpredir.debian.org/debian/ jessie/main libcgi-fast-perl all 1:2.04-1 [10.9 kB]
Get:16 http://httpredir.debian.org/debian/ jessie/main libclass-c3-perl all 0.26-1 [22.9 kB]
Get:17 http://httpredir.debian.org/debian/ jessie/main libclass-c3-xs-perl amd64 0.13-2+b1 [15.2 kB]
Get:18 http://httpredir.debian.org/debian/ jessie/main libcpan-meta-perl all 2.142690-1 [125 kB]
Get:19 http://httpredir.debian.org/debian/ jessie/main libparams-util-perl amd64 1.07-2+b1 [23.5 kB]
然后,执行gitbook update指令
gitbook update
Installing GitBook 2.6.9 gitbook@2.6.9 ../../tmp/tmp-696O1xaZ1k3moC8/node_modules/gitbook
├── bash-color@0.0.3 ├── escape-string-regexp@1.0.3 ├── nunjucks-filter@1.0.0 ├── gitbook-plugin-livereload@0.0.1 ├── gitbook-plugin-sharing@1.0.1 ├── gitbook-plugin-fontsettings@1.0.2 ├── github-slugid@1.0.0 ├── nunjucks-autoescape@1.0.0 ├── jsonschema@1.0.2 ├── spawn-cmd@0.0.2 ├── q@1.0.1 ├── json-schema-defaults@0.1.1 ├── graceful-fs@3.0.5 ├── semver@5.0.1 ├── urijs@1.17.0 ├── crc@3.2.1 ├── tmp@0.0.24 ├── dom-serializer@0.1.0 (domelementtype@1.1.3, entities@1.1.2)
├── resolve@0.6.3 ├── npmi@0.1.1 (semver@4.3.6)
├── merge-defaults@0.2.1 (lodash@2.4.2)
├── send@0.2.0 (fresh@0.2.4, range-parser@1.0.3, mime@1.2.11, debug@3.2.7)
├── i18n@0.5.0 (sprintf@0.1.5, mustache@4.2.0, debug@3.2.7)
├── fs-extra@0.16.5 (jsonfile@2.4.0, rimraf@2.7.1)
├── gitbook-plugin-highlight@1.0.3 (highlight.js@8.8.0)
├── cheerio@0.19.0 (entities@1.1.2, css-select@1.0.0, htmlparser2@3.8.3)
├── request@2.51.0 (forever-agent@0.5.2, aws-sign2@0.5.0, tunnel-agent@0.4.3, caseless@0.8.0, oauth-sign@0.5.0, stringstream@0.0.6, json-stringify-safe@5.0.1, mime-types@1.0.2, qs@2.3.3, node-uuid@1.4.8, combined-stream@0.0.7, tough-cookie@4.0.0, http-signature@0.10.1, bl@0.9.5, form-data@0.2.0, hawk@1.1.1)
├── fstream-ignore@1.0.2 (inherits@2.0.4, minimatch@2.0.10, fstream@1.0.12)
├── nunjucks@2.2.0 (asap@2.0.6, optimist@0.6.1)
├── tiny-lr@0.2.1 (parseurl@1.3.3, livereload-js@2.4.0, qs@5.1.0, debug@2.2.0, faye-websocket@0.10.0, body-parser@1.14.2)
├── gitbook-plugin-search@1.1.0 (lunr@0.5.12)
├── lodash@3.10.1 ├── gitbook-parsers@0.8.9 (q@1.5.1, gitbook-restructuredtext@0.2.3, gitbook-markdown@0.5.3, gitbook-asciidoc@0.2.4)
├── chokidar@1.0.6 (is-glob@1.1.3, arrify@1.0.1, path-is-absolute@1.0.1, async-each@0.1.6, is-binary-path@1.0.1, glob-parent@1.3.0, readdirp@1.4.0, anymatch@1.3.2)
├── juice@1.5.0 (commander@2.3.0, slick@1.12.1, batch@0.5.2, cssom@0.3.0, web-resource-inliner@1.1.4)
└── npm@2.4.1 GitBook has been updated to 2.6.9
- 安装2.6.9版本
gitbook fetch 2.6.9
Installing GitBook 2.6.9 gitbook@2.6.9 ../../tmp/tmp-7549kmSUI82yuf6/node_modules/gitbook
├── bash-color@0.0.3 ├── escape-string-regexp@1.0.3 ├── nunjucks-filter@1.0.0 ├── gitbook-plugin-livereload@0.0.1 ├── gitbook-plugin-sharing@1.0.1 ├── gitbook-plugin-fontsettings@1.0.2 ├── github-slugid@1.0.0 ├── nunjucks-autoescape@1.0.0 ├── jsonschema@1.0.2 ├── spawn-cmd@0.0.2 ├── q@1.0.1 ├── json-schema-defaults@0.1.1 ├── graceful-fs@3.0.5 ├── semver@5.0.1 ├── urijs@1.17.0 ├── crc@3.2.1 ├── tmp@0.0.24 ├── dom-serializer@0.1.0 (domelementtype@1.1.3, entities@1.1.2)
├── merge-defaults@0.2.1 (lodash@2.4.2)
├── npmi@0.1.1 (semver@4.3.6)
├── resolve@0.6.3 ├── send@0.2.0 (fresh@0.2.4, range-parser@1.0.3, mime@1.2.11, debug@3.2.7)
├── i18n@0.5.0 (sprintf@0.1.5, mustache@4.2.0, debug@3.2.7)
├── request@2.51.0 (tunnel-agent@0.4.3, forever-agent@0.5.2, aws-sign2@0.5.0, caseless@0.8.0, oauth-sign@0.5.0, stringstream@0.0.6, json-stringify-safe@5.0.1, mime-types@1.0.2, qs@2.3.3, node-uuid@1.4.8, combined-stream@0.0.7, tough-cookie@4.0.0, http-signature@0.10.1, form-data@0.2.0, hawk@1.1.1, bl@0.9.5)
├── fs-extra@0.16.5 (jsonfile@2.4.0, rimraf@2.7.1)
├── tiny-lr@0.2.1 (parseurl@1.3.3, livereload-js@2.4.0, qs@5.1.0, debug@2.2.0, body-parser@1.14.2, faye-websocket@0.10.0)
├── nunjucks@2.2.0 (asap@2.0.6, optimist@0.6.1)
├── fstream-ignore@1.0.2 (inherits@2.0.4, minimatch@2.0.10, fstream@1.0.12)
├── gitbook-plugin-search@1.1.0 (lunr@0.5.12)
├── cheerio@0.19.0 (entities@1.1.2, css-select@1.0.0, htmlparser2@3.8.3)
├── gitbook-parsers@0.8.9 (q@1.5.1, gitbook-restructuredtext@0.2.3, gitbook-markdown@0.5.3, gitbook-asciidoc@0.2.4)
├── chokidar@1.0.6 (is-glob@1.1.3, arrify@1.0.1, path-is-absolute@1.0.1, async-each@0.1.6, is-binary-path@1.0.1, glob-parent@1.3.0, readdirp@1.4.0, anymatch@1.3.2)
├── gitbook-plugin-highlight@1.0.3 (highlight.js@8.8.0)
├── lodash@3.10.1 ├── juice@1.5.0 (commander@2.3.0, slick@1.12.1, batch@0.5.2, cssom@0.3.0, web-resource-inliner@1.1.4)
└── npm@2.4.1 GitBook 2.6.9 has been installed
喜欢请赞赏一下啦^_^