Adds docker build support

This commit is contained in:
Nemo 2020-10-19 14:18:01 +05:30
parent dc9c720509
commit 192a56960d
6 changed files with 43 additions and 5 deletions

5
.dockerignore Normal file
View File

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

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
vendor/
*.epub
html/*
chapters/*
*.html

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM debian:bullseye-slim
LABEL maintainer="ebooks@captnemo.in"
ARG DEBIAN_FRONTEND="noninteractive"
WORKDIR /src
RUN apt-get update && apt-get install -y --no-install-recommends \
pandoc \
ruby \
wget \
zlib1g-dev bundler \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /src/
RUN bundle install
ENTRYPOINT ["/src/generate.sh"]
VOLUME ["/output"]

View File

@ -33,6 +33,7 @@ Your generated ebook should be available at never-say-you-cant-survive.epub
<li>Embrace Uncertainty: The Joy of Making a Giant Mess</li>
<li>Everything Is Broken! What Should I Write About?</li>
</ol></details>
<details><summary>Section II - Whats A Story, and How Do You Find One?</summary><ol>
<li>Dont Be Afraid to Go on Lots of First Dates With Story Ideas</li>
<li>The Secret to Storytelling? Just One Good Scene, and Then Another, and Another.</li>
@ -41,6 +42,7 @@ Your generated ebook should be available at never-say-you-cant-survive.epub
<li>How to Tell a Thrilling Story Without Breaking Your Own Heart</li>
<li>The Ending Is The Beginning</li>
</ol></details>
<details><summary>Section III - Your Feelings are Valid—and Powerful</summary><ol>
<li>Hold On To Your Anger. Its a Storytelling Goldmine</li>
<li>People Are Only as Interesting as Their Relationships</li>
@ -48,12 +50,16 @@ Your generated ebook should be available at never-say-you-cant-survive.epub
<li>Revision Is the Process of Turning Fake Emotion Into Real Emotion</li>
<li>Twelve Ways to Keep the Fun of Writing Alive</li>
</ol></details>
<details><summary>Section IV - What We Write About When We Write About Spaceships</summary><ol>
<li>How to Write a Political Story Without Falling on Your Face</li>
<li>Good Worldbuilding Shows How Things Could Be Different</li>
<li>The Unexamined Story Is Not Worth Writing</li>
<li>Weirdness Gives Me the Strength To Keep Going</li>
<li>When Is It Okay To Write About Someone Elses Culture or Experience?</li>
</ol></details>
<details><summary>Section V: How to Use Writerly Tricks to Gain Unstoppable Powers</summary><ol>
<li>Find Your Voice and Make It LOUD</li>
</ol></details>

View File

@ -52,7 +52,9 @@ for i in Dir.glob('html/*.html')
end
end
fn = File.basename(i)
File.write("chapters/#{fn}", html)
File.open("chapters/#{fn}", "w:UTF-8") do |f|
f.write html
end
end
html = ""
@ -61,8 +63,7 @@ File.open("urls.txt").each_with_index do |url, index|
unless section_headers[index].nil?
html += "<h1>#{section_headers[index]}</h1>\n\n"
end
html += File.read("chapters/#{title}.html")
html += "\n\n"
html += File.open("chapters/#{title}.html", "r:UTF-8", &:read)
end
File.write("never-say-you-cant-survive.html", html)

View File

@ -20,3 +20,7 @@ do
done < "$INPUT_FILE"
bundle exec ruby generate.rb
if [ -f /.dockerenv ]; then
cp never-say-you-cant-survive.epub /output
fi