惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
T
Tenable Blog
Webroot Blog
Webroot Blog
L
Lohrmann on Cybersecurity
S
Securelist
S
Schneier on Security
NISL@THU
NISL@THU
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
I
Intezer
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
TaoSecurity Blog
TaoSecurity Blog
S
Secure Thoughts
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Privacy International News Feed
H
Hacker News: Front Page
N
Netflix TechBlog - Medium
M
MIT News - Artificial intelligence
博客园 - Franky
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog
P
Proofpoint News Feed
S
Security Affairs
WordPress大学
WordPress大学
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
小众软件
小众软件
F
Full Disclosure
博客园 - 叶小钗
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
Security Latest
Security Latest
P
Proofpoint News Feed
月光博客
月光博客
T
Tailwind CSS Blog
Scott Helme
Scott Helme
Hacker News - Newest:
Hacker News - Newest: "LLM"
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs
Help Net Security
Help Net Security
Project Zero
Project Zero

John Bokma's Hacking and Hiking

Failed to verify signature archive-contents.sig in Emacs Aquamacs 3.6 Hangs When Saving An Encrypted File PAR trouble How To Create a Bootable LibreELEC Installation using Mac OS A Docker Image for Sass Timezones in Alpine Docker Containers A Tale of Three Docker Images Debugging a Perl Docker container Perl Time::Piece Unicode Issue Giving Docker Desktop for macOS a Second Chance Flashing another TP-Link TL-WDR4300 with OpenWrt firmware Rehousing two tarantulas Getting started with the Perl version of tumblelog on Ubuntu 18.04 LTS A visit to Avonturia De Vogelkelder Flashing a TP-Link TL-WDR4300 with OpenWrt firmware Mounting a VDI File in a Different VirtualBox Guest Wireless Headless Raspberry Pi - John Bokma A Matter of Time - John Bokma Hand coding an RSS 2.0 feed in Python RFC #822 and RFC #3339 dates in Perl RFC #822 and RFC #3339 dates in Python Hand coding an RSS 2.0 feed in Perl Nav Element with no Heading Rewriting CommonMark Nodes in Perl "right" this time
Running pdflatex Using the Alpine Pandoc LaTeX Docker Image
John Bokma · 2021-06-19 · via John Bokma's Hacking and Hiking

June 20, 2021

I use a custom Perl script which uses pdflatex to generate invoices for my customers. Currently the program runs in a VirtualBox virtual machine (Ubuntu). But since I want to switch to Apple Silicon in the near future I am currently moving several programs to Docker. I was able to make the Perl program, after a few minor modifications, on macOS except for the external call to pdflatex. Since I want to reduce the number of programs I have to install directly on macOS I decided to "dockerize" pdflatex.

Because I want the Docker image to be small I started out with an Alpine image. But installing texlive-full resulted in an image of several gigabytes! After a few experiments I decided to see if I could just run pdflatex from a Pandoc Docker image I already needed for creating my resume.

$ docker run --rm --entrypoint pdflatex resume-pandoc
This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded forma
t=pdflatex)
 restricted \write18 enabled.
**
! End of file on the terminal... why?

Because this image is "just" 686.6MB I decided to try to create a new image using pandoc-latex as a base:

# syntax=docker/dockerfile:1
FROM pandoc/latex:latest

ENTRYPOINT ["pdflatex"]

I build the Docker image using:

docker build -t pdflatex .

When running the container using:

docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pdflatex \
    invoice.tex

I got the following error message:

! LaTeX Error: File `sectsty.sty' not found.

Since I had seen the same error when building the image I use to create my resume I already knew the solution: install the missing package using tlmgr. So I updated the Dockerfile:

# syntax=docker/dockerfile:1
FROM pandoc/latex:latest

RUN tlmgr update --self && tlmgr install sectsty

ENTRYPOINT ["pdflatex"]

Running the newly created image resulted in another error:

! LaTeX Error: File `lastpage.sty' not found.

So I added this package as well, resulting in:

# syntax=docker/dockerfile:1
FROM pandoc/latex:latest

RUN tlmgr update --self && tlmgr install sectsty lastpage

ENTRYPOINT ["pdflatex"]

This time I got yet another error, but one that was a bit harder to fix:

! Font T1/phv/m/n/10=phvr8t at 10.0pt not loadable: Metric (TFM) file not found
.

A font was missing, but which one, and which package to install? Googling the error message gave a quick answer: helvetic. Adding this to the installation step resulted in a working image; I now could generate a PDF invoice from a TeX input file.

# syntax=docker/dockerfile:1
FROM pandoc/latex:latest

RUN tlmgr update --self && tlmgr install sectsty lastpage helvetic

ENTRYPOINT ["pdflatex"]