Open PeterDaveHello opened 2 months ago
Hey sure why not, can we base it on the one from https://pptr.dev/guides/docker?
FROM ghcr.io/puppeteer/puppeteer:latest
RUN npm install --global md-to-pdf
CMD [md-to-pdf]
sth like this?
We can, just the image seems to be a little bit huge, but maybe nobody cares? I don't know. Let me know if you have preference, maybe I can help test and send a PR for it.
google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf libxss1 dbus dbus-x11
this is the list of packages it installs (source), what would you omit? Or would you not base it on node:20
? Not sure how to make it smaller 🤷🏻♂️
Edit: maybe by not installing Chrome, and letting the puppeteer
package download it post-install instead? Hm or maybe it's better to just also add ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1
.
FROM ghcr.io/puppeteer/puppeteer:latest
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1
USER root
RUN npm install --global md-to-pdf
USER pptruser
ENTRYPOINT ["md-to-pdf"]
CMD ["--help"]
this is what I came up with now and seems to work fine but happy to get a better suggestion (:
$ docker build . -t md-to-pdf
then
$ docker run -v $(pwd):$(pwd) -w $(pwd) md-to-pdf readme.md
[11:06:17] generating PDF from readme.md [started]
[11:06:24] generating PDF from readme.md [completed]
I used to use Alpine-based node.js image and install the dependencies as mentioned here, but no guarantee which is better:
Might be better cause the Puppeteer image comes with Puppeteer pre-installed which we don't actually need. But I like that this way we don't need to define/maintain a list of deps to install, leaving that to the Puppeteer team 🤓
Sure, sounds great, I found the image even correctly handles Chinese fonts already.
Problem:
The
md-to-pdf
project currently lacks a Dockerfile, which may lead to:md-to-pdf
into CI/CD pipelines for automated conversion of Markdown files to PDF.Solution:
Add a Dockerfile to the project, providing an official, containerized environment with all necessary dependencies pre-installed. This would simplify the setup process, ensure consistency across different systems, enhance portability, and enable seamless integration with CI/CD pipelines.
If you believe this feature would be valuable to the project, I would be happy to submit a pull request containing a basic Dockerfile. Please let me know your thoughts on this suggestion. Thank you for considering this proposal!