rob-luke / emails-html-to-pdf

Convert emails without attachments to pdf and send as email
32 stars 7 forks source link

Reduce Docker image size #18

Closed mirisbowring closed 2 years ago

mirisbowring commented 2 years ago

Hi,

i've tried several ways to implement this project into a small alpine container.

https://github.com/Surnet/docker-wkhtmltopdf provides a very good base image with python support. Nevertheless, i ran into trouble when installing the pip dependencies. I've read some documentation and guides and found this one: https://pythonspeed.com/articles/alpine-docker-python/ seems like using alpine would not significantly decrease the image size.

Since the primary target of #17 was to decrease the total image size, i tried to change from python:3.9 to python:3.9-slim.

Et voila: The image size was reduced from 1.5GB to 330MB!

In my eyes, this PR will solve the idea behind #17 though it does not use alpine exactly.

A positive side effect I switched from upstream wkhtmltopdf to static precompiled one which includes qt-patches that are neccessary for some options that can be added since #12.

rob-luke commented 2 years ago

Nice as always! Thanks @mirisbowring Also just a note, I realised I could simplify the docker image path, so the work image has not been removed from the image name. Hope that isnt too annoying