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
|
||||
|
||||
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
|
||||
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 . /
|
||||
|
||||
RUN bundle install
|
||||
VOLUME ["/output"]
|
||||
|
|
34
README.md
34
README.md
|
@ -8,6 +8,19 @@ Original sources are downloaded from https://landing.google.com/sre/
|
|||
|
||||
# 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
|
||||
|
||||
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:
|
||||
|
||||
- Ruby
|
||||
- gem install bundler
|
||||
- gem install nokogiri
|
||||
- brew install pandoc
|
||||
- brew cask install calibre
|
||||
- brew install wget
|
||||
|
||||
## Docker
|
||||
|
||||
Requirements:
|
||||
|
||||
- Docker
|
||||
|
||||
```
|
||||
$ ./build_docker.sh
|
||||
```
|
||||
- `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.
|
||||
|
|
14
bootstrap.sh
14
bootstrap.sh
|
@ -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…
Reference in New Issue