美文网首页
Docker搭配Gitbook进行文档部署

Docker搭配Gitbook进行文档部署

作者: 思考的猩猩 | 来源:发表于2019-06-21 14:40 被阅读0次

    构建目录结构

    nginx-docker
        --default.conf
        --docker-compose.yml
        --web
            ---note
    

    拉取文档仓库并编译

    git pull && rm -rf _book && gitbook install && gitbook build .
    

    编写nginx服务配置

    ➜  nginx-docker cat default.conf 
    server {
      listen 80;
      server_name your_hostname;
      root /web;
    
      location /note {
        alias /web/note/_book;
        index index.html;
      }
    
      location  ^~ gitbook/ {
        root /web/gitbook/;
       }
    }
    

    通过docker启动

    编写docker-compse.yml

    ➜  nginx-docker cat docker-compose.yml 
    version: '2'
    
    services:
      nginx:
        image: nginx:latest
        restart: always
        container_name: nginx-web
        network_mode: host
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - ./web:/web
          - ./default.conf:/etc/nginx/conf.d/default.conf
    

    启动容器

    ➜  docker-compose up -d
    

    相关文章

      网友评论

          本文标题:Docker搭配Gitbook进行文档部署

          本文链接:https://www.haomeiwen.com/subject/icvyqctx.html