Add support for building eBook with Docker
This change adds support for building the eBook with Docker. Supporting Docker means that users who want to build the eBook do not have to install Ruby/Bundler/Calibre in their environments. I'm a Docker n00b, so if there's a better way to handle file permissions on the output, I'm all ears. Build tested on Linux. Outputs were fine. There is also a change to the pandoc outputs. It seems the `+smart` extension is not supported for epub/html[0] in their latest versions. [0] - https://pandoc.org/MANUAL.html#extension-smart
This commit is contained in:
parent
98e83282f6
commit
2ff063e9b3
|
@ -0,0 +1,16 @@
|
|||
FROM ubuntu:17.10
|
||||
|
||||
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
|
14
README.md
14
README.md
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue