Docker Build Support (#8)

Add support for building eBook with Docker
This commit is contained in:
Nemo 2018-05-17 01:19:54 +05:30 committed by GitHub
commit 7d0fe14980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 1 deletions

18
Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
build-essential \
calibre \
pandoc \
ruby \
ruby-dev \
wget \
zlib1g-dev
RUN gem install bundler --no-ri --no-rdoc
COPY . /
RUN bundle install

View File

@ -6,6 +6,10 @@ Generates a EPUB/MOBI for the Google SRE Book.
Original sources are downloaded from https://landing.google.com/sre/
# Build
## macOS
Review and run the `bootstrap.sh` script to generate the EPUB and MOBI files
Requirements:
@ -17,6 +21,16 @@ Requirements:
- brew cask install calibre
- brew install wget
## Docker
Requirements:
- Docker
```
$ ./build_docker.sh
```
# Known Issues
- Inline references are not handled in the best possible way

View File

@ -13,6 +13,6 @@ bundle install
ruby generate.rb
pushd html/chapters
pandoc -f html+smart -t epub+smart -o ../../google-sre.epub --epub-metadata=../../metadata.xml --epub-cover-image=../../cover.jpg sre.html
pandoc -f html -t epub -o ../../google-sre.epub --epub-metadata=../../metadata.xml --epub-cover-image=../../cover.jpg sre.html
popd
ebook-convert google-sre.epub google-sre.mobi

7
build_docker.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
docker build -t google-sre-ebook .
docker run -i --rm -v "$(pwd):/output" google-sre-ebook sh -s <<EOF
./bootstrap.sh
chown -v $(id -u):$(id -g) /google-sre.*
mv -f /google-sre.* /output
EOF