Small docker image for tectonic

#1

In case anyone finds this useful, here’s a very small (only 54MB compressed) docker image with working tectonic, including a primed cache that reduces the number of files tectonic needs to download when running. It works great with gitlab CI, yielding <1minute build times.

See https://hub.docker.com/r/rekka/tectonic/

In the future, it would be great to actually link tectonic statically via musl with all its libraries since then it could be put on top of Alpine Linux to produce an even smaller image.

2 Likes
#2

Yes, that’s very interesting! I’ll try if it works with Travis as well and I’ll report back (on your GitHub repo, I guess) if it does.
(and I’d add it to my repo at https://github.com/PHPirates/travis-ci-latex-pdf if you allow)

#3

Yep, feel free to include it. I’m curios about travis, keep me posted.

#4

That’s awesome, thanks for sharing!

@malbarbo on GitHub just posted a set of instructions to get Tectonic to link statically on musl — here. There’s a bit of work to do to integrate this seamlessly into master, but you could probably snarf it for a Docker image pretty straightforwardly …

#5

Oh nice, thanks for the link! Good timing.

Making compilation work on musl looks a bit more complicated than I was hoping it would be. I might revisit it in the future when the musl support is a bit better. serde_derive not working is a big one.

#6

After learning what Docker actually is I found out the following works for Travis: (not so clean as for GitLab, but I like that the build file is so much cleaner compared to installing everything manually!)

assuming there is a file src/main.tex

sudo: required

services:
  - docker

script:
  # We use the docker image from https://hub.docker.com/r/rekka/tectonic/
  - docker pull rekka/tectonic
  - docker run --mount src=$TRAVIS_BUILD_DIR/src,target=/usr/src/tex,type=bind rekka/tectonic tectonic main.tex

Actually the build time was indeed just under a minute on first test. I think there’s no need to cache this docker image on Travis as it seems really fast to start up. It’s cool.

2 Likes
#7

Nice, thanks for testing it out.

#8

Based on rekkas work I extended the docker image by adding the optional ability to run biber. It uses latest tectonic at the time of writing (0.1.10). Its a little bit bigger ~75mb (for obvious reasons :grinning: ) .
You can find the image here:

https://hub.docker.com/r/dxjoke/tectonic-docker/

The code you can find here:

EDIT: Updated image to 0.1.11

#9

Thanks @dxjoke, that’s cool!

I haven’t been focusing on this topic, but I am more than ready to merge PRs that help get some of the needed functionality into mainline. As I recall some patches were needed — we could use the Cargo “feature” functionality to give users the option to compile with the needed change if desired.

I’m also happy to create a repo within the tectonic-typesetting GitHub organization to host an official Dockerfile!

1 Like
#10

@pkgw Yup, it’s cool :smile: it’s used for example in this instruction repo for Travis builds: https://github.com/PHPirates/travis-ci-latex-pdf#instructions-for-building-with-docker-and-tectonic
and at tex.stackexchange.com, essentially advertising tectonic :slight_smile:

It would be cool if a docker image could be hosted under tectonic-typesetting, such that it’s also useful for CI.

I’m not sure what patches you mean and what Cargo has to do with it, but we may be talking a different use case.