docker搭建gitbook服務


Gitbook

Gitbook簡介

GitBook 是一個基於 Node.js 的命令行工具,可使用 Github/Git 和 Markdown 來制作精美的電子書,GitBook 並非關於 Git 的教程。

GitBook支持輸出多種文檔格式:

  • 靜態站點:GitBook默認輸出該種格式,生成的靜態站點可直接托管搭載Github Pages服務上;
  • PDF:需要安裝gitbook-pdf依賴;
  • eBook:需要安裝ebook-convert;
  • 單HTML網頁:支持將內容輸出為單頁的HTML,不過一般用在將電子書格式轉換為PDF或eBook的中間過程;
  • JSON:一般用於電子書的調試或元數據提取。

GitBook基礎文件

使用GitBook制作電子書,必備兩個文件:README.md和SUMMARY.md。

Docker安裝Gitbook

查找gitbook鏡像

docker@default:~$ docker search -s 3 gitbook
NAME                         DESCRIPTION                               STARS     OFFICIAL   AUTOMATED
fellah/gitbook               GitBook                                   9                    [OK]
tobegit3hub/gitbook-server                                             7                    [OK]
fellah/gitbook-ebook                                                   3                    [OK]
billryan/gitbook             Docker for GitBook with Unicode support   3                    [OK]

安裝gitbook鏡像,官方鏡像下載太慢的話可以使用國內的daocloud

docker@default:~$ docker pull fellah/gitbook

獲取gitbook靜態html文件,/yourpath下需要有README.md和SUMMARY.md文件。

docker run -v /yourpath:/srv/gitbook -v /yourpath/html:/srv/html fellah/gitbook gitbook build . /srv/html

展示Gitbook文件

因為生成的是html靜態頁面所以需要一個web服務來顯示,當前選擇用nginx。
搜索nginx鏡像

docker@default:~$ docker search -s 3 nginx
NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
nginx                                    Official build of Nginx.                        3350      [OK]
jwilder/nginx-proxy                      Automated Nginx reverse proxy for docker c...   691                  [OK]
richarvey/nginx-php-fpm                  Container running Nginx + PHP-FPM capable ...   215                  [OK]
jrcs/letsencrypt-nginx-proxy-companion   LetsEncrypt container to use with nginx as...   71                   [OK]
million12/nginx-php                      Nginx + PHP-FPM 5.5, 5.6, 7.0 (NG), CentOS...   67                   [OK]
maxexcloo/nginx-php                      Docker framework container with Nginx and ...   57                   [OK]
webdevops/php-nginx                      Nginx with PHP-FPM                              42                   [OK]
h3nrik/nginx-ldap                        NGINX web server with LDAP/AD, SSL and pro...   27                   [OK]
bitnami/nginx                            Bitnami nginx Docker Image                      18                   [OK]
maxexcloo/nginx                          Docker framework container with Nginx inst...   7                    [OK]
webdevops/nginx                          Nginx container                                 5                    [OK]
million12/nginx                          Nginx: extensible, nicely tuned for better...   5                    [OK]
evild/alpine-nginx                       Minimalistic Docker image with Nginx            4                    [OK]
webdevops/hhvm-nginx                     Nginx with HHVM                                 3                    [OK]
ixbox/nginx                              Nginx on Alpine Linux.                          3                    [OK]

安裝nginx

docker pull nginx

啟動nginx服務

docker run --name my-nginx -v /yourpath/html:/usr/share/nginx/html -d -p 8080:80 nginx

系統是linux的話在這就已經完成了,Mac和windows還需要配置端口轉發,配置本地和docker的虛擬機之間的端口映射。

gitbook鏡像地址nginx的鏡像地址


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM