This is another part of an everlasting story in which someone, somewhere, thinks that the task at hand might better be automated.

Automate all the things!
Automate all the things!


Currently, I'm on par with my efforts, but you're invited to keep on reading!

Create, Update, Forget, Repeat

Back when I applied for my first job, which was around 2002 (time flies...), I had to write my first CV.

And as soon as I got the job, I almost immediately forgot about my CV again.

Then the next time I needed an up-to-date CV, my previous efforts had long vanished, so it was time to do it all over again...

And the next time I needed an up-to-date CV, my previous efforts had long vanished, so it was time to do it all over again... Again...

And the next time I needed an up-to-date CV... Well, you know the story...

Fast-forward to today, I just updated my CV,

which is what I do quite regularly since I learned the hard way that it takes some time to remember what you did over the last few years.

But I also spent some time on my overall CV setup to make it more "enjoyable".

Create, Update, Commit, Repeat

Quite many things changed since I had to write my first CV, and for most of the time I kept track of what I've been doing using a Word document and Dropbox / Ubuntu One etc.

Around the time when I was about to finish my master's thesis in computer science I began to think about creating a new CV.

And since I like to keep track of things, it should be version controlled, so I created a new repository on my server and opened a LaTeX template.

Around the same time I started to overhaul my webpage, which resulted in my shell-like landing page and a more graphical version.

Automate the Boring Stuff

Both pages serve my CV for download, but with my initial setup, I had to manually build both PDF documents to later manually copy them to the right place.

Doing things manually is rather cumbersome, so I started to think about automating the process...

The workflow to automate this job is simple:

  1. Checkout committed changes
  2. Generate PDF files
  3. Move them into the right place

All the magic is done via a simple post-update git hook, which in turn is just a simple shell script.

git clone $REPO $TMP
cd $TMP
for i in *.tex ; do
    docker run -v $(pwd):/pwd s1hofmann/texlive:latest "$i"
    if [ $? -eq 0 ]; then
        mv "${i%.tex}.pdf" $DEST
rm -rf $TMP

I decided to build a TexLive container,

since the full package is rather large (the image has approx 2.9GB) and I don't want to have it installed on my server just to build my CV.

FROM debian:stable-slim
LABEL maintainer="s1hofmann"
LABEL version="0.1"

RUN apt-get update && apt-get install texlive-full -y
RUN mkdir /pwd
ENTRYPOINT ["/usr/bin/latexmk", "-pdf"]

It's just a simple wrapper which mounts a local directory and runs latexmk on the passed file.

Now if the LaTeX build has been successful,

the generated PDF files are moved to their public folder and my poor man's version of a CD pipeline is complete.

Great, another step towards containerizing all services on my private server!

Maybe I'll tick Jekyll off my list next time, we'll see...

So long