Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Official TinyTex Docker image #25

Open
dl1ch opened this issue Sep 8, 2022 · 3 comments
Open

Official TinyTex Docker image #25

dl1ch opened this issue Sep 8, 2022 · 3 comments
Assignees

Comments

@dl1ch
Copy link

dl1ch commented Sep 8, 2022

Hi!

First of all I would like to thank you for this great product you put together.

Second, I would like to ask if you have a plan on creating an official TinyTex docker image?
It could have all the tags (TinyTex-0 / 1 / 2 ) and even supports multiple architectures.

For my own purposes I created the following dockerfile (attached below), but if an official minimal image would be available on dockerhub or elsewhere it would be awesome. It would allow us (other users) not to bother with the installation, but only to add the needed plugins and run the app / generate the PDF (I assume its mostly used for generating PDF files).

My current dockerfile is:

FROM ubuntu:22.04

RUN apt-get update && apt-get install -y perl wget libfontconfig1 && \
    wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh  && \
    apt-get clean
ENV PATH="${PATH}:/root/bin"
RUN fmtutil-sys --all

# My custom requirements for generating the PDF file (should be added and installed via requirements.txt file)
RUN tlmgr install fancyhdr xcolor enumitem geometry tcolorbox titlesec wallpaper textpos tocloft ragged2e float fontspec lastpage pgf environ ncctools eso-pic oberdiek
@yihui
Copy link
Member

yihui commented Sep 8, 2022

Thanks for the suggestion! I'm not really familiar with Docker now. The last time I tried to build a Docker image was 8 years ago...

We don't have a plan to create an official image, but it seems that building a Docker image for TinyTeX is simple enough. I'm okay with providing one (or multiple), but I need to talk to our IT first, since I don't have the privilege to publish to docker hub.

@cderv
Copy link
Contributor

cderv commented Sep 9, 2022

This is an interesting suggestion.

Until now, it was not something that user asked for because TinyTeX is mainly used by R users with the tinytex package to produce documents with R Markdown. And for this purpose, the rocker project (https://rocker-project.org/) offers already some images which contains TinyTeX (espcially rocker/verse). However, they are not lightweight and contain other R tools like the tidyverse.

Are you a R user ? Or just using TinyTeX as a non R-User ?

It is indeed quite easy to create a docker image wiht TinyTeX only. Some users have done it (https://github.com/superruzafa/docker-tinytex), but it means it would be indeed easy for us to create such images.

We could build the image as part of our monthly release pipeline to update them at the same time. We could publish for the CI pipeline (https://docs.github.com/en/actions/publishing-packages/publishing-docker-images)

Github Packages is another place where we could publish this kind of things (https://github.com/features/packages) - I believed it is already at RStudio @yihui.

It would mean the image would be available with something like

docker pull ghcr.io/rstudio/tinytex:v2022-09-0-bionic

or something like that.

Anyway, creating docker images for TinyTeX is not a difficult task. Doing it at each monthly release can be automated, and it will just add more storage to what is already stored on Github (in the Releases).

We already provide a script to install our binaries, which is a one liner in a docker environment as you did.

RUN  curl -sL https://yihui.org/tinytex/install-bin-unix.sh | sh

We could make that more visible from here, and document with example how to install the various bundles with this script.

So I am not against providing images to do that for the user, but I always wonder if that worth it to add more data on the web when it did not solve a lot of pain.

I'll ask out IT about what is possible for us to support anyway.

@cderv cderv moved this to Backlog in R Markdown Team Projects Sep 9, 2022
@cderv cderv moved this from Backlog to To discuss / To plan in R Markdown Team Projects Sep 9, 2022
@dl1ch
Copy link
Author

dl1ch commented Sep 9, 2022

No, I'm not familiar with the R-Project.

I use TinyTex as a (Xetex) generator of the Latex files to create PDF files. To be more exact I have automated some reporting to gather data from different sources (Python scripts) to fill in Latex files (.tex files) and then TinyTex (with the custom plugins as you saw above) to generate the PDF file. Now this all runs via the Gitlab CI (I know its not the best option), but when I searched for a lightweight Latex to PDF generator, I found TexLive (which is NOT lightweight) and this wonderful project. If you also check dockerhub you can see a lot of people did their own versions of the TinyTex dockerimage, but these are mostly out-of-date or not supported docker files (https://hub.docker.com/search?q=tinytex). This kind of not having an official docker image more prone to errors, issues and users not choosing "this product".

Also if you check the docker image of the TexLive Project (https://hub.docker.com/r/texlive/texlive), you can see that its widely used (500K+) but the image itself is 2GB+ in size which is really not that user and CI friendly as TinyTex could be.

I know this takes some effort to create the CI workflows, but after that everything is automated, users will use the up-to-date images and I believe more and more users will start using it this way (rather than TexLive). Also in their automations as I did.

If the storage is an issue, i would suggest on creating at least the minimal docker image (TinyTex-0) package, so everyone could have the base image ready with everything in place. As if you program in Python, you start with the official docker image (https://hub.docker.com/_/python) which is around 16MB and then add the needed plugins for your project. The same could be done for generating PDFs from Latex files.

In this case I would suggest to make it like:

docker pull ghcr.io/rstudio/tinytex:latest

And optional:
docker pull ghcr.io/rstudio/tinytex:TT0-2022-09
docker pull ghcr.io/rstudio/tinytex:TT1-latest
docker pull ghcr.io/rstudio/tinytex:TT1-2022-09
docker pull ghcr.io/rstudio/tinytex:TT2-latest
docker pull ghcr.io/rstudio/tinytex:TT2-2022-09

Or something similar.

The OS is currently not an issue... I used ubuntu because its easier to create a docker file, but after the optimizations and everything also more lightweight distros could be used (Alpine).

Thanks for taking this in consideration :)

@cderv cderv self-assigned this Sep 13, 2022
@cderv cderv moved this from To discuss / To plan to Todo in R Markdown Team Projects Sep 13, 2022
@cderv cderv moved this from Todo to To discuss / To plan in R Markdown Team Projects Sep 20, 2022
@cderv cderv moved this from To discuss / To plan to Backlog in R Markdown Team Projects Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

3 participants