Easier Docker workflow
This commit is contained in:
parent
7d0fe14980
commit
577b0bf25c
|
@ -0,0 +1,5 @@
|
||||||
|
html/
|
||||||
|
.direnv
|
||||||
|
*.epub
|
||||||
|
*.mobi
|
||||||
|
vendor/
|
18
Dockerfile
18
Dockerfile
|
@ -1,18 +1,22 @@
|
||||||
FROM ubuntu:latest
|
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 \
|
build-essential \
|
||||||
calibre \
|
calibre \
|
||||||
pandoc \
|
pandoc \
|
||||||
ruby \
|
ruby \
|
||||||
ruby-dev \
|
ruby-dev \
|
||||||
wget \
|
wget \
|
||||||
zlib1g-dev
|
zlib1g-dev \
|
||||||
|
&& gem install bundler --no-ri --no-rdoc \
|
||||||
|
&& bundle install
|
||||||
|
|
||||||
RUN gem install bundler --no-ri --no-rdoc
|
ENTRYPOINT ["/src/bootstrap.sh", "docker"]
|
||||||
|
|
||||||
COPY . /
|
VOLUME ["/output"]
|
||||||
|
|
||||||
RUN bundle install
|
|
||||||
|
|
34
README.md
34
README.md
|
@ -8,6 +8,19 @@ Original sources are downloaded from https://landing.google.com/sre/
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
|
||||||
|
## Docker (Preferred)
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
|
||||||
|
- Docker
|
||||||
|
|
||||||
|
`docker run --rm --volume "$(pwd):/output" captn3m0/google-sre-ebook:latest`
|
||||||
|
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
The build for the above Docker image can be audited at <https://cloud.docker.com/swarm/captn3m0/repository/docker/captn3m0/google-sre-ebook/builds>.
|
||||||
|
|
||||||
## macOS
|
## macOS
|
||||||
|
|
||||||
Review and run the `bootstrap.sh` script to generate the EPUB and MOBI files
|
Review and run the `bootstrap.sh` script to generate the EPUB and MOBI files
|
||||||
|
@ -15,21 +28,11 @@ Review and run the `bootstrap.sh` script to generate the EPUB and MOBI files
|
||||||
Requirements:
|
Requirements:
|
||||||
|
|
||||||
- Ruby
|
- Ruby
|
||||||
- gem install bundler
|
- `gem install bundler`
|
||||||
- gem install nokogiri
|
- `gem install nokogiri`
|
||||||
- brew install pandoc
|
- `brew install pandoc`
|
||||||
- brew cask install calibre
|
- `brew cask install calibre`
|
||||||
- brew install wget
|
- `brew install wget`
|
||||||
|
|
||||||
## Docker
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
|
|
||||||
- Docker
|
|
||||||
|
|
||||||
```
|
|
||||||
$ ./build_docker.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
# Known Issues
|
# Known Issues
|
||||||
|
|
||||||
|
@ -37,7 +40,6 @@ $ ./build_docker.sh
|
||||||
- metadata.xml is not complete. There are just too many authors
|
- metadata.xml is not complete. There are just too many authors
|
||||||
- Foreword/Preface is not part of the index
|
- Foreword/Preface is not part of the index
|
||||||
|
|
||||||
|
|
||||||
# LICENSE
|
# LICENSE
|
||||||
|
|
||||||
This is licensed under WTFPL. See COPYING file for the full text.
|
This is licensed under WTFPL. See COPYING file for the full text.
|
||||||
|
|
14
bootstrap.sh
14
bootstrap.sh
|
@ -1,18 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
rm -rf html
|
rm -rf html
|
||||||
mkdir -p html
|
mkdir -p html
|
||||||
cd 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/* .
|
mv landing.google.com/sre/book/* .
|
||||||
rm -rf landing.google.com
|
rm -rf landing.google.com
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
bundle install
|
if [ $1 != "docker" ];then
|
||||||
|
bundle install
|
||||||
|
fi
|
||||||
|
|
||||||
ruby generate.rb
|
ruby generate.rb
|
||||||
|
|
||||||
pushd html/chapters
|
pushd html/chapters
|
||||||
pandoc -f html -t epub -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
|
popd
|
||||||
ebook-convert google-sre.epub google-sre.mobi
|
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…
Reference in New Issue