I’m trying to install wkhtmltopdf in my docker environment. what ever I try it fails. my current Dockerfile looks like this
FROM python:3.8.5
...
...
# Installation of dependencies Abhängigkeiten
RUN apt-get update
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get install -y ghostscript -f
RUN apt-get install -y fontforge -f
RUN apt-get install -y cabextract -f
RUN wget https://gist.github.com/maxwelleite/10774746/raw/ttf-vista-fonts-installer.sh -q -O - | bash
RUN apt-get install -y wget
RUN wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
RUN apt-get install -f
RUN dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
and this ends with the following error codes
Step 13/32 : RUN dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
---> Running in 49712db15630
Selecting previously unselected package wkhtmltox.
(Reading database ... 26470 files and directories currently installed.)
Preparing to unpack wkhtmltox_0.12.6-1.bionic_amd64.deb ...
Unpacking wkhtmltox (1:0.12.6-1.bionic) ...
dpkg: dependency problems prevent configuration of wkhtmltox:
wkhtmltox depends on libjpeg-turbo8; however:
Package libjpeg-turbo8 is not installed.
wkhtmltox depends on xfonts-75dpi; however:
Package xfonts-75dpi is not installed.
wkhtmltox depends on xfonts-base; however:
Package xfonts-base is not installed.
dpkg: error processing package wkhtmltox (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
wkhtmltox
The command '/bin/sh -c dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb' returned a non-zero code: 1
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
i tried with all different available wkhtmltopdf installations and none of it worked. Anyone can help?
2
Answers
You could use apt-get install to fix up missing dependencies. Example:
I see a couple of problems here. First, you are trying to install an Ubuntu Bionic Beaver version of WKHTMLTOPDF on a Debian Buster os. So, I would recommend using the correct release.
Second, you are clearly missing some dependencies as stated in the error message. So you should install those.
Lastly, this is purely optional, but I would recommend grouping your install commands in one layer (one Docker command here
RUN
), this will help make your final image smaller.Here is the content of a Dockerfile that would build.
Cheers