Skip to content

Instantly share code, notes, and snippets.

@eiri
Created March 21, 2019 23:51
Show Gist options
  • Save eiri/543c7640323579fe2a6871213ff36933 to your computer and use it in GitHub Desktop.
Save eiri/543c7640323579fe2a6871213ff36933 to your computer and use it in GitHub Desktop.
gitbook in docker

Usage

Build image

docker build . -t eiri/gitbook:3.2.2

Serve gitbook

Thew assumption that the source is in local build directory.

docker run -v $(pwd)/build:/srv/gitbook -p 4000:4000 --rm -it eiri/gitbook:3.2.2

Build gitbook

docker run -v $(pwd)/build:/srv/gitbook -v $(pwd):/srv/html --rm -it eiri/gitbook:3.2.2 gitbook build . /srv/html

FROM node:8.11-alpine
RUN npm install --global gitbook-cli && \
gitbook fetch 3.2.2 && \
gitbook install && \
npm cache clear --force && \
rm -rf /tmp/*
# Fixes https://github.com/GitbookIO/gitbook/issues/1309
RUN sed -i.bak 's/confirm: true/confirm: false/g' \
/root/.gitbook/versions/3.2.2/lib/output/website/copyPluginAssets.js
WORKDIR /srv/gitbook
VOLUME /srv/gitbook /srv/html
EXPOSE 4000 35729
CMD /usr/local/bin/gitbook serve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment