Joseph Jude

Consult . Code . Coach

Write your book using softcover and docker


tech . books . nodejs . hapijs

Just before starting this blog post, I submitted the final manuscript for my first book. Writing a book is a long and tiring work with uncertain future. Much like a startup.

Writing the book went like this: We, my sister and I, pitched the book to Apress in January, 2016; they vetted the book proposal and approved it; we wrote the book for six months and submitted for review; an editor and a technical reviewer gave their suggestions; we modified and resubmitted; the content of the book is now approved and sent for publishing.

It is still not read by any potential reader. We don't know if the market will accept it or reject it.

I am writing my next book in a different way. I am borrowing the idea of "agile model" from software development practice. Following the agile model, I am writing it in an incremental and iterative model with feedback from potential readers.

Some established publishers like Oreilly already have early release programs. This allows authors to obtain feedback as they progress. I could approach them. But, hyperlinks subverts hierarchy. So, why not try on my own?

I found a platform that supports this mental model. Softcover calls itself a frictionless self-publishing platform. They pay up to 90% royalty. That is not the only reason to love it. Michael Hartl, its founder has worked hard to provide an open business model. He has provided an open source build tool that any author can use to write and generate ebooks. Authors are not even tied to sell using Softcover site. There are no monthly charges. Just a flat 10% fee on a sale through softcover platform. I like this model. So I have chosen it for my next book.

Softcover provides a tool that converts markdown based content into neatly formatted ebooks (mobi, epub, and pdf). It depends on nodejs, ruby, and LaTex so on. Instead of installing all of these on my machine, I chose to use Docker. Docker is best suited for such tools. If you don't know about docker, read this overview post at hackernoon.

Nick Merwin from Softcover has already provided the necessary Dockerfile. It is based on Ubuntu. It works like a charm.

Working with softcover within docker goes like this:

For reference the Dockerfile is listed here:

FROM phusion/baseimage:0.9.11
# https://github.com/phusion/baseimage-docker
MAINTAINER Nick Merwin <[email protected]>

ENV HOME /root
RUN /etc/my_init.d/00_regen_ssh_host_keys.sh
CMD ["/sbin/my_init"]

RUN apt-get update \
  && apt-get install -y ruby gems g++ ruby-dev libcurl3 libcurl3-gnutls \
  libcurl4-openssl-dev imagemagick default-jre inkscape phantomjs \
  calibre texlive-full nodejs

# nodejs => node
RUN cd /usr/local/bin && ln -s /usr/bin/nodejs node

WORKDIR /root

RUN curl -LO \
  https://github.com/IDPF/epubcheck/releases/download/v3.0/epubcheck-3.0.zip \
  && unzip epubcheck-3.0.zip -d bin && rm epubcheck-3.0.zip

RUN curl -LO \
  http://kindlegen.s3.amazonaws.com/kindlegen_linux_2.6_i386_v2_9.tar.gz \
  && tar -zxvf kindlegen_linux_2.6_i386_v2_9.tar.gz \
  && rm kindlegen_linux_2.6_i386_v2_9.tar.gz \
  && cd /usr/local/bin \
  && ln -s ~/kindlegen kindlegen

RUN apt-get install -y libxslt-dev libxml2-dev build-essential
RUN gem install softcover --pre --no-ri --no-rdoc

RUN softcover check

RUN mkdir /book
WORKDIR /book

EXPOSE 4000

I would like to convert this into an alpine based image. I tried, but I got so many errors. I will have to try it later.

If you are interested, you can follow as I update the book. Check it out at softcover.


Like the post? Retweet it. Got comments? Reply.

Write your book using softcover and @docker by @jjude: https://t.co/Ko2AimxRGR

— Joseph Jude (@jjude) March 6, 2017
Share this on: Twitter / /

Comments

comments powered by Disqus