Adds docker build support

pull/2/head
Nemo 2 years ago
parent dc9c720509
commit 192a56960d
  1. 5
      .dockerignore
  2. 1
      .gitignore
  3. 23
      Dockerfile
  4. 6
      README.md
  5. 7
      generate.rb
  6. 6
      generate.sh

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

1
.gitignore vendored

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

@ -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"]

@ -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 - What’s A Story, and How Do You Find One?</summary><ol>
<li>Don’t 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. It’s 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 Else’s 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>

@ -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)

@ -19,4 +19,8 @@ do
wget --no-clobber --no-verbose --output-document="html/$FILENAME.html" --timeout=10 "$line"
done < "$INPUT_FILE"
bundle exec ruby generate.rb
bundle exec ruby generate.rb
if [ -f /.dockerenv ]; then
cp never-say-you-cant-survive.epub /output
fi
Loading…
Cancel
Save