Easier Docker workflow

pull/10/head
Nemo 5 years ago
parent 7d0fe14980
commit 577b0bf25c

@ -0,0 +1,5 @@
html/
.direnv
*.epub
*.mobi
vendor/

@ -1,18 +1,22 @@
FROM ubuntu:latest
ARG DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && apt-get install -y \
COPY . /src/
WORKDIR /src
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
calibre \
pandoc \
ruby \
ruby-dev \
wget \
zlib1g-dev
RUN gem install bundler --no-ri --no-rdoc
zlib1g-dev \
&& gem install bundler --no-ri --no-rdoc \
&& bundle install
COPY . /
ENTRYPOINT ["/src/bootstrap.sh", "docker"]
RUN bundle install
VOLUME ["/output"]

@ -8,28 +8,31 @@ 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
## Docker (Preferred)
Requirements:
- Ruby
- gem install bundler
- gem install nokogiri
- brew install pandoc
- brew cask install calibre
- brew install wget
- Docker
## Docker
`docker run --rm --volume "$(pwd):/output" captn3m0/google-sre-ebook:latest`
Requirements:
- You should see the final EPUB/MOBI files in the `output` directory after the above runs.
- The file may be owned by the root user.
- Docker
The build for the above Docker image can be audited at <https://cloud.docker.com/swarm/captn3m0/repository/docker/captn3m0/google-sre-ebook/builds>.
```
$ ./build_docker.sh
```
## macOS
Review and run the `bootstrap.sh` script to generate the EPUB and MOBI files
Requirements:
- Ruby
- `gem install bundler`
- `gem install nokogiri`
- `brew install pandoc`
- `brew cask install calibre`
- `brew install wget`
# Known Issues
@ -37,7 +40,6 @@ $ ./build_docker.sh
- metadata.xml is not complete. There are just too many authors
- Foreword/Preface is not part of the index
# LICENSE
This is licensed under WTFPL. See COPYING file for the full text.

@ -1,18 +1,28 @@
#!/bin/bash
# Cleanup
rm -rf html
mkdir -p html
cd html
wget --convert-links --mirror https://landing.google.com/sre/book/
# Download
wget --convert-links --mirror https://landing.google.com/sre/book/
mv landing.google.com/sre/book/* .
rm -rf landing.google.com
cd ..
bundle install
if [ $1 != "docker" ];then
bundle install
fi
ruby generate.rb
pushd html/chapters
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
if [ "$1"=="docker" ]; then
chown -v $(id -u):$(id -g) google-sre.*
mv -f google-sre.* /output
fi

@ -1,7 +0,0 @@
#!/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…
Cancel
Save