├── .dockerignore ├── Dockerfile └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | .git 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM billryan/gitbook:base 2 | MAINTAINER Rhett 3 | 4 | # add non-root user(workaround for docker) 5 | # replace gid and uid with your currently $GID and $UID 6 | #RUN useradd -m -g 100 -u 1000 gitbook 7 | #USER gitbook 8 | 9 | # install gitbook versions 10 | RUN gitbook fetch latest 11 | 12 | ENV BOOKDIR /gitbook 13 | 14 | VOLUME $BOOKDIR 15 | 16 | EXPOSE 4000 17 | 18 | WORKDIR $BOOKDIR 19 | 20 | CMD ["gitbook", "--help"] 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-gitbook 2 | 3 | A Docker Container for [gitbook](https://github.com/GitbookIO/gitbook). Inspired by 4 | 5 | - [grahamc/docker-jekyll](https://github.com/grahamc/docker-jekyll) 6 | - [tobegit3hub/gitbook-server](https://github.com/tobegit3hub/gitbook-server) 7 | - [humangeo/gitbook-docker](https://github.com/humangeo/gitbook-docker) 8 | 9 | Docker Hub: 10 | 11 | ## Usage 12 | 13 | Read the official [GitBook Toolchain Documentation](http://toolchain.gitbook.com/) documentation [GitbookIO/gitbook](https://github.com/GitbookIO/gitbook#how-to-use-it) first. 14 | 15 | ```bash 16 | # init 17 | docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook init 18 | # serve 19 | docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook serve 20 | # build 21 | docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook build 22 | ``` 23 | 24 | For short, you can use alias for the long command line text. Place the alias statement in your `.bashrc` or `.zshrc`. 25 | 26 | ```bash 27 | alias gitbook='docker run --rm -v "$PWD":/gitbook -p 4000:4000 billryan/gitbook gitbook' 28 | # init 29 | gitbook init 30 | # serve 31 | gitbook serve 32 | # build 33 | gitbook build 34 | # pdf output 35 | gitbook pdf . 36 | ``` 37 | 38 | ### User Priviledge 39 | 40 | Since docker **can not** config uid and gid for shared volume properly(see [Issue #7198](https://github.com/docker/docker/issues/7198)), you can build it with your own uid and gid in the Dockerfile. 41 | 42 | ## Features 43 | 44 | Build **your favourite fonts** with GitBook(PDF, EPUB). Visit [billryan/gitbook/tags](https://hub.docker.com/r/billryan/gitbook/tags/) to see whether your favourite languages/fonts are listed here. You can also check the GitHub branch since the docker hub is automated-build from GitHub. 45 | 46 | ## Contributing 47 | 48 | Wanna nice fonts for your GitBook? Here we go! 49 | 50 | 1. checkout a new branch named with your languages and fonts. The name of languages should follow the [List of ISO 639-2 codes](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes) and [rfc4646](http://www.ietf.org/rfc/rfc4646.txt), and the length of the name should as short as possible. 51 | ```bash 52 | git checkout -b new-branch master 53 | ``` 54 | 2. Modify the following lines with your favourite fonts. 55 | ```bash 56 | # install fonts 57 | RUN apt-get update \ 58 | && apt-get install -y fonts-your-language 59 | ``` 60 | 61 | ## License 62 | 63 | [The MIT License (MIT)](https://opensource.org/licenses/MIT) 64 | --------------------------------------------------------------------------------