martinthomson / i-d-template

A template for IETF internet draft git repositories
Other
208 stars 182 forks source link

Install tex2svg and asciitex #259

Closed larseggert closed 3 years ago

larseggert commented 3 years ago

This will hopefully allow https://github.com/NTAP/rfc8312bis to build, which uses the new ~~~ math artwork that kramdown-rfc2629 now supports.

martinthomson commented 3 years ago

This docker file is only used by CircleCI; if you want GH actions, you need to update the other too.

Just checking now about the size difference. I really didn't want to have to install node and npm here; large images add significantly to the running time of CI.

martinthomson commented 3 years ago

sooo...many...node...packages. Building the image takes a very long time with all those node modules. And that's just before the 172 extra for mathjax-node-cli.

Here's the delta (my reference image is old, but it won't have changed much):

lars-math                                       latest              3fa2750122ce        5 seconds ago       530MB
martinthomson/i-d-template                      latest              b53f78b1eb11        8 weeks ago         318MB

That's a pretty steep tax. I'll need to think about it.

larseggert commented 3 years ago

I made the change to the other Dockerfile, just so that the PR is at least complete.

Yes, the size issue sucks. I hate node.

larseggert commented 3 years ago

Have you considered using Alpine instead of Ubuntu for your build image? It is much (~150MB) smaller by default.

martinthomson commented 3 years ago

Would it really make that much of a difference? The main problem is that there are lots of dependencies from the stuff this already uses (git alone is terrible, but ruby and python aren't small either).

I'd consider a pull request that made the change though.

martinthomson commented 3 years ago

I have an alpine image working and it is ~150M smaller, but I don't think that I want to use that reduction to justify an increase.

The problem here is that there is so much advantage in having the tools in the base image. So it makes sense to have different images for people who need the math. But in order to use a different image, you need to change where your configuration file points. For GitHub, that also means defining an entirely new action as well. You could do that in your fork of the repository (you can copy the actions I use to create the image, probably skipping dockerhub uploads). But the end result is pretty poor because you now have a continual rebasing problem to work through.

How about we try this: Take a look at the alpine branch on this repo and see if you can make a new docker/math subdirectory with a dockerfile that uses the one from docker/action as a baseline. Then, I will create a new branch for action.yml and we can change the file to point to this new image, tag that as math or something, and we'll see how that works. Then, you can just tweak your configuration to use the @math version of the action.

That might be the way to do this without adding 200M to the size of the image everyone else uses.

larseggert commented 3 years ago

Is the docker image you build from action/Dockerfile available? Because then I could base the math image on it (and basically only require downloading the delta layers) rather than making a fully separate image that shares much of the same underlying Dockerfile?

larseggert commented 3 years ago

Are the tags martinthomson/i-d-template-action for the GitHub actions image and martinthomson/i-d-template for the CircleCI one?

larseggert commented 3 years ago

For now, I've just duplicated most of action/Dockerfile for the math/Dockerfile in #260.

larseggert commented 3 years ago

FWIW, if I install all the dependencies that kramdown-rfc2629 might possibly want, the image is at 1.5GB...

martinthomson commented 3 years ago

Hi @larseggert, I've published a package that contains the updated image. This isn't mainline yet, because I want to test it. Can you modify your .github/workflows on the rfc8312bis repo to use martinthomson/i-d-template@v1m instead of @v1 throughout and see how that works out? You might need to remove the additions to the Makefile that install stuff using apt-get, because that won't work with these alpine-based images.

The image is ~340M, which isn't ideal, but I now have a "maxi-sized" image branch that can be used for other things. I don't think that a super-maxi image of 1.5G is something I ever want though. I guess that rules out making Rust available :).

larseggert commented 3 years ago

I tried that , but *** [math:] sh: tex2svg: not found. See https://github.com/NTAP/rfc8312bis/pull/40/checks?check_run_id=1854225262#step:6:16

martinthomson commented 3 years ago

Oops, a PATH issue. I forgot to add -g to npm install. Try again?

(BTW, that's a LOT of node modules.)

larseggert commented 3 years ago

The error is different now: /usr/lib/ruby/2.7.0/open3.rb:213:in 'spawn': No such file or directory - svgcheck (Errno::ENOENT). See https://github.com/NTAP/rfc8312bis/runs/1862957748?check_suite_focus=true#step:6:17

martinthomson commented 3 years ago

Thanks for checking. I think that this is a genuine problem with what kramdown-rfc2629 and the rest of the stuff you installed pull down. Now we just need to find svgcheck.

martinthomson commented 3 years ago

I've just pushed a change to include svgcheck in the main image (it's small). That might take a little while to build, but it should be good to try again in a little while.

larseggert commented 3 years ago

Now it worked: https://github.com/NTAP/rfc8312bis/actions/runs/547794430

martinthomson commented 3 years ago

I think that we can close this now.

larseggert commented 3 years ago

So should I use martinthomson/i-d-template@v1m now going forward?

martinthomson commented 3 years ago

If you want to use the image with the extra tools installed, yeah.