From 2ff063e9b31163e1aa5a0d64ab598d07f04ede21 Mon Sep 17 00:00:00 2001 From: Caleb Mingle Date: Tue, 15 May 2018 10:41:05 -0700 Subject: [PATCH 1/2] 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 --- Dockerfile | 16 ++++++++++++++++ README.md | 14 ++++++++++++++ bootstrap.sh | 2 +- build_docker.sh | 7 +++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100755 build_docker.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e275edf --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 9347997..475914b 100644 --- a/README.md +++ b/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 diff --git a/bootstrap.sh b/bootstrap.sh index 3b8286e..70ef38c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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 diff --git a/build_docker.sh b/build_docker.sh new file mode 100755 index 0000000..8c450e4 --- /dev/null +++ b/build_docker.sh @@ -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 < Date: Wed, 16 May 2018 10:52:38 -0700 Subject: [PATCH 2/2] Pin to latest Ubuntu --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e275edf..02f2038 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM ubuntu:17.10 +FROM ubuntu:latest + +ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ build-essential \