Make bootstrap script compatible with both variants

This commit is contained in:
Nemo 2019-01-31 21:16:28 +05:30
parent ceb4d3db91
commit 2f4c533d06
3 changed files with 19 additions and 11 deletions

View File

@ -5,8 +5,6 @@ LABEL maintainer="github.google-sre-ebook@captnemo.in"
ARG DEBIAN_FRONTEND="noninteractive"
COPY . /src/
WORKDIR /src
RUN apt-get update && apt-get install -y --no-install-recommends \
@ -17,11 +15,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ruby-dev \
wget \
zlib1g-dev \
file \
&& gem install bundler --no-ri --no-rdoc \
&& bundle install \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /src/
RUN bundle install
ENV NO_BUNDLE_INSTALL=true
ENTRYPOINT ["/src/bootstrap.sh", "docker"]
VOLUME ["/output"]

View File

@ -29,10 +29,9 @@ wget \
--recursive \
--domains=${IMGS_DOMAIN},landing.google.com ${TOC_URL}
#
MODE=${1:-}
: "${NO_BUNDLE_INSTALL:=false}"
if [ "$MODE" != "docker" ];then
if [ "$NO_BUNDLE_INSTALL" != "true" ];then
bundle install
fi
@ -61,10 +60,13 @@ pandoc --from=html --to=epub \
complete.html
popd
for EXTENSION in mobi pdf; do
ebook-convert ${BOOK_FILE}.epub ${BOOK_FILE}.${EXTENSION}
done
if [[ command -v ebook-convert ]]; then
for EXTENSION in mobi pdf; do
ebook-convert ${BOOK_FILE}.epub ${BOOK_FILE}.${EXTENSION}
done
fi
# TODO: Replace this with a better check
if [ "$1"=="docker" ]; then
chown -v $(id -u):$(id -g) ${BOOK_FILE}.*
mv -f ${BOOK_FILE}.* /output

View File

@ -2,7 +2,7 @@ FROM ruby:alpine
LABEL maintainer="docker@captnemo.in"
RUN apk add \
RUN apk add --no-cache \
build-base \
linux-headers \
wget \
@ -22,6 +22,8 @@ RUN gem install bundler --no-ri --no-document \
WORKDIR /src
ENTRYPOINT ["/src/bootstrap.sh", "docker", "epub"]
ENV NO_BUNDLE_INSTALL=true
ENTRYPOINT ["/src/bootstrap.sh", "docker"]
VOLUME ["/output"]