﻿<feed xmlns="http://www.w3.org/2005/Atom">
  <title type="text" xml:lang="en">Docker</title>
  <link type="application/atom+xml" href="https://d.moonfire.us/tags/docker/atom.xml" rel="self" />
  <link type="text/html" href="https://d.moonfire.us/tags/docker/" rel="alternate" />
  <updated>2026-08-15T17:42:46Z</updated>
  <id>https://d.moonfire.us/tags/docker/</id>
  <author>
    <name>D. Moonfire</name>
  </author>
  <rights>Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International</rights>
  <entry>
    <title>MfGames Writing Upkeep</title>
    <link rel="alternate" href="https://d.moonfire.us/blog/2021/02/05/mfgames-writing-upkeep/" />
    <updated>2021-02-05T06:00:00Z</updated>
    <id>https://d.moonfire.us/blog/2021/02/05/mfgames-writing-upkeep/</id>
    <category term="programming" scheme="https://d.moonfire.us/categories/" label="Programming" />
    <category term="mfgames-writing" scheme="https://d.moonfire.us/tags/" label="MfGames Writing" />
    <category term="yoman" scheme="https://d.moonfire.us/tags/" label="Yoman" />
    <category term="docker" scheme="https://d.moonfire.us/tags/" label="Docker" />
    <summary type="html">As usual between major projects, I try to spend a little time working on maintenance and upkeep of the multitude of projects that I've written or contributed too.
</summary>
    <content type="html">&lt;p&gt;As usual between major projects, I try to spend a little time working on maintenance and upkeep of the multitude of projects that I've written or contributed too. It is somewhat random, but I had a task to move two of my Node packages, &lt;a href="https://www.npmjs.com/package/@mfgames-writing/ncx"&gt;@mfgames-writing/ncx&lt;/a&gt; and &lt;a href="https://www.npmjs.com/package/@mfgames-writing/opf"&gt;@mfgames-writing/opf&lt;/a&gt; into the &lt;a href="https://gitlab.com/mfgames-writing/mfgames-writing-js"&gt;mfgames-writing monorepo&lt;/a&gt; when I had done the rest of the projects.&lt;/p&gt;
&lt;p&gt;The decision to convert to a single repository for a multiple of projects took me quite a while. Mostly it came from the problem I have with package-based arrangements, the &amp;ldquo;rail car&amp;rdquo;. When I have to make a change to a library but that change has to be propagated through a number of packages until the one that needed the change. It looks like a chain and it's tedious when I'm doing rapid sets of changes trying to figure something out.&lt;/p&gt;
&lt;p&gt;Now, I could just do everything in a single monolithic project, basically have a &lt;code&gt;mfgames-writing&lt;/code&gt; package that does everything, but I still follow the Unix Philosophy: Do One Thing Well. The individual packages handle EPUB, PDF, and HTML generation. It feels &amp;ldquo;wrong&amp;rdquo; to force all of them to be combined together.&lt;/p&gt;
&lt;p&gt;In the end, I want separate packages but I dislike the process of working with them. With Node packages, I found &lt;a href="https://lerna.js.org/"&gt;Lerna&lt;/a&gt; which handles a lot of that forwarding, plus plays well with &lt;a href="https://semantic-release.gitbook.io/semantic-release/"&gt;semantic-release&lt;/a&gt; and &lt;a href="https://www.conventionalcommits.org/"&gt;conventional commits&lt;/a&gt;. I've been happy, but it was a learning process and I missed two packages.&lt;/p&gt;
&lt;p&gt;I also reformatting the code and switched testing over to Jest. It bumped up a few versions, but that always seem to happen when I'm learning things.&lt;/p&gt;
&lt;p&gt;While that cleans up most of the packages, there are a few others related packages I still need to convert, namely the &lt;a href="https://hub.docker.com/r/dmoonfire/mfgames-writing-js/"&gt;Docker image&lt;/a&gt; and the &lt;a href="https://www.npmjs.com/package/generator-mfgames-writing"&gt;Yoman generator&lt;/a&gt;. Those are completely different than the core packages, so they shouldn't be in the monorepo in my opinion.&lt;/p&gt;
&lt;p&gt;But those can wait until next around.&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title>Working with MfGames Writing, CI, and Docker</title>
    <link rel="alternate" href="https://d.moonfire.us/blog/2018/08/24/mfgames-writing-docker-and-ci/" />
    <updated>2018-08-24T05:00:00Z</updated>
    <id>https://d.moonfire.us/blog/2018/08/24/mfgames-writing-docker-and-ci/</id>
    <category term="programming" scheme="https://d.moonfire.us/categories/" label="Programming" />
    <category term="writing" scheme="https://d.moonfire.us/categories/" label="Writing" />
    <category term="docker" scheme="https://d.moonfire.us/tags/" label="Docker" />
    <category term="markdown" scheme="https://d.moonfire.us/tags/" label="Markdown" />
    <category term="mfgames-writing" scheme="https://d.moonfire.us/tags/" label="MfGames Writing" />
    <category term="gitlab" scheme="https://d.moonfire.us/tags/" label="Gitlab" />
    <summary type="html">How to use a continual integration (CI) server to publish projects.
</summary>
    <content type="html">&lt;p&gt;One of the main points of having &lt;a href="/tags/mfgames-writing/"&gt;MfGames Writing&lt;/a&gt; is to automate the publication process.&lt;/p&gt;
&lt;h1&gt;Series&lt;/h1&gt;
&lt;p&gt;I appear to be writing a short series of post about the tools I use for publication and writing.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/13/publishing-processes/"&gt;Semantic Versions and Releases&lt;/a&gt;: Why semantic versioning helps with the writing process.&lt;/li&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/21/mfgames-writing-reasons/"&gt;Evolution of MfGames Writing&lt;/a&gt;: A brief history and reasoning behind the tools.&lt;/li&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/22/mfgames-writing-init/"&gt;First Steps Using MfGames Writing&lt;/a&gt;: Starting a new project with MfGames Writing.&lt;/li&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/23/mfgames-writing-content/"&gt;Adding Content to MfGames Writing&lt;/a&gt;: Adding front and back matter to novels.&lt;/li&gt;
&lt;li&gt;Working with MfGames Writing, CI, and Docker: Adding automatic building with commits.&lt;/li&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/25/mfgames-writing-formats/"&gt;Additional Formats for MfGames Writing&lt;/a&gt;: How to create PDF, MOBI, DOCX, and HTML versions.&lt;/li&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/26/mfgames-writing-themes/"&gt;Theming for MfGames Writing&lt;/a&gt;: A light introduction on how to customize the output.&lt;/li&gt;
&lt;li&gt;&lt;a href="/blog/2018/08/27/mfgames-writing-releases/"&gt;Integrating Semantic Versioning into MfGames Writing&lt;/a&gt;: Tying semantic releases into the process.&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;Adding Scripts&lt;/h1&gt;
&lt;p&gt;We've installed the commands in a previous step, but hooking them up in the &lt;code&gt;package.json&lt;/code&gt; makes life a lot easier.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-json"&gt;{
  &amp;quot;name&amp;quot;: &amp;quot;test-project&amp;quot;,
  &amp;quot;private&amp;quot;: true,
  &amp;quot;version&amp;quot;: &amp;quot;0.0.0&amp;quot;
  &amp;quot;scripts&amp;quot;: {
    &amp;quot;build:epub&amp;quot;: &amp;quot;mfgames-writing-format build epub&amp;quot;,
    &amp;quot;build:pdf&amp;quot;: &amp;quot;mfgames-writing-format build pdf&amp;quot;,
    &amp;quot;build:html&amp;quot;: &amp;quot;mfgames-writing-format build html&amp;quot;,
    &amp;quot;build:docx&amp;quot;: &amp;quot;sed 's@&amp;amp;#173;@@g' &amp;lt; $npm_package_name-$npm_package_version.html | pandoc -f html -t docx -o $npm_package_name-$npm_package_version.docx&amp;quot;,
    &amp;quot;build:mobi&amp;quot;: &amp;quot;kindlegen $npm_package_name-$npm_package_version.epub&amp;quot;,
    &amp;quot;build&amp;quot;: &amp;quot;npm run build:epub &amp;amp;&amp;amp; npm run build:mobi &amp;amp;&amp;amp; npm run build:pdf &amp;amp;&amp;amp; npm run build:html &amp;amp;&amp;amp; npm run build:docx&amp;quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Basically this sets up my basic suite of scripts that let me generate everything or one specific file.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-shell"&gt;$ npm run build:epub
$ npm run build
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You can see we use a couple other programs like &lt;code&gt;pandoc&lt;/code&gt; to make DOCX files from HTML or MOBI files using the EPUB file and &lt;code&gt;kindlegen&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I use &lt;code&gt;$npm_package_name&lt;/code&gt; to pull in the package name (as I said, I use them for consistency) which lets me produce files with a consistent pattern including the version number.&lt;/p&gt;
&lt;p&gt;The other formats (HTML, PDF, etc) will be talked about in &lt;a href="/blog/2018/08/25/mfgames-writing-formats/"&gt;tomorrow's post&lt;/a&gt;.&lt;/p&gt;
&lt;h1&gt;CI Configuration&lt;/h1&gt;
&lt;p&gt;I use &lt;a href="https://gitlab.com/"&gt;GitLab&lt;/a&gt; as my primary development platform. I like the company, the fact they open-source much of their code, and their features. Most important is that they provide private repos, which means I can have one repo for every novel I work on.&lt;/p&gt;
&lt;p&gt;GitLab has a continual integration (CI) service which will automatically run whenever I push up code. This is controlled by the &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file.&lt;/p&gt;
&lt;pre&gt;&lt;code class="language-yaml"&gt;# This Docker image contains all the libraries and tools to generate files.
image: dmoonfire/mfgames-writing-js:1.1.1

stages:
    - publish

publish:
    stage: publish
    tags:
        - docker

    # Generate the various publication files.
    script:
        - npm ci
        - npm run build

    # Keeping artifacts means we can download them after the fact.
    artifacts:
        expire_in: 1 week
        paths:
            - &amp;quot;*.pdf&amp;quot;
            - &amp;quot;*.epub&amp;quot;
            - &amp;quot;*.mobi&amp;quot;
            - &amp;quot;*.docx&amp;quot;
            - &amp;quot;*.html&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If CI is turned on in GitLab and this file is present, then it will automatically run the commands in the &lt;code&gt;script&lt;/code&gt; section. It then takes the resulting PDF, EPUB, MOBI, DOCX, and HTML files and zips them up to be found on the website. Basically this runs the same command that you can run manually which makes it easier to test.&lt;/p&gt;
&lt;p&gt;&lt;a href="/blog/2018/08/mfgames-writing-download.png"&gt;&lt;img class="img-responsive post-img-link" src="/blog/2018/08/mfgames-writing-download.png" alt="Download Button" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;Docker&lt;/h1&gt;
&lt;p&gt;In the &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; file, you may notice we use a Docker image &lt;code&gt;dmoonfire/mfgames-writing-js:1.1.1&lt;/code&gt;. This is up on &lt;a href="https://hub.docker.com/r/dmoonfire/mfgames-writing-js/"&gt;DockerHub&lt;/a&gt; and includes the various programs and utilities needed to generate the files. Some of the formats, in specific &lt;a href="https://weasyprint.org/"&gt;WeasyPrint&lt;/a&gt;, have specific installations and I found that having a Docker image makes life a lot easier.&lt;/p&gt;
&lt;p&gt;The image contains:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NPM and required packages&lt;/li&gt;
&lt;li&gt;WeasyPrint&lt;/li&gt;
&lt;li&gt;KindleGen&lt;/li&gt;
&lt;li&gt;Pandoc&lt;/li&gt;
&lt;li&gt;PdfTk (pdfcat)&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
</feed>
