Fix #216 #218
This commit is contained in:
康怀帅
2017-11-21 19:05:06 +08:00
committed by GitHub
parent fcc6535910
commit 48a3624644
11 changed files with 124 additions and 12 deletions

26
.travis/Dockerfile Normal file
View File

@@ -0,0 +1,26 @@
FROM node:9-alpine
ENV TZ=Asia/Shanghai
WORKDIR /srv/gitbook
COPY book.json book.json
COPY docker-entrypoint.sh /usr/local/bin/
RUN apk add --no-cache \
tzdata \
&& npm install -g gitbook-cli \
&& gitbook install \
&& ln -s /usr/local/bin/docker-entrypoint.sh / \
&& rm -rf /root/.npm /tmp/*
EXPOSE 4000
VOLUME /srv/gitbook-src
WORKDIR /srv/gitbook-src
ENTRYPOINT ["docker-entrypoint.sh"]
CMD server

30
.travis/book.json Normal file
View File

@@ -0,0 +1,30 @@
{
"title": "Docker -- 从入门到实践",
"author": "yeasy",
"plugins": [
"image-captions",
"github-buttons",
"page-treeview"
],
"pluginsConfig": {
"image-captions": {
"attributes": {
"width": "600"
},
"caption": "图 _PAGE_LEVEL_._PAGE_IMAGE_NUMBER_ - _CAPTION_"
},
"github-buttons": {
"repo": "yeasy/docker_practice",
"types": [
"star",
"watch"
],
"size": "small"
},
"page-treeview": {
"copyright": "Copyright © yeasy",
"minHeaderCount": "2",
"minHeaderDeep": "2"
}
}
}

View File

@@ -0,0 +1,5 @@
sut:
build: .
volumes:
- ../:/srv/gitbook-src
command: build

19
.travis/docker-entrypoint.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
START=`date "+%F %T"`
if [ $1 = "sh" ];then sh ; exit 0; fi
rm -rf node_modules _book
cp -a . ../gitbook
cd ../gitbook
main(){
if [ "$1" = build ];then gitbook build; cp -a _book ../gitbook-src; echo $START; date "+%F %T"; exit 0; fi
gitbook serve
exit 0
}
main $1 $2 $3

8
.travis/update.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# cd .travis
# ./update.sh
if [ ! -f Dockerfile ];then exit 1; fi
cp -a ../book.json book.json