A Docker Container for gitbook. Inspired by
Docker Hub: https://hub.docker.com/r/billryan/gitbook/
Read the official GitBook Toolchain Documentation documentation GitbookIO/gitbook first.
# init
docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook init
# serve
docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook serve
# build
docker run --rm -v "$PWD:/gitbook" -p 4000:4000 billryan/gitbook gitbook build
For short, you can use alias for the long command line text. Place the alias statement in your .bashrc
or .zshrc
.
alias gitbook='docker run --rm -v "$PWD":/gitbook -p 4000:4000 billryan/gitbook gitbook'
# init
gitbook init
# serve
gitbook serve
# build
gitbook build
# pdf output
gitbook pdf .
Since docker can not config uid and gid for shared volume properly(see Issue #7198), you can build it with your own uid and gid in the Dockerfile.
Build your favourite fonts with GitBook(PDF, EPUB). Visit 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.
Wanna nice fonts for your GitBook? Here we go!
- checkout a new branch named with your languages and fonts. The name of languages should follow the List of ISO 639-2 codes and rfc4646, and the length of the name should as short as possible.
git checkout -b new-branch master
- Modify the following lines with your favourite fonts.
# install fonts
RUN apt-get update \
&& apt-get install -y fonts-your-language