Public | Automated Build

Last pushed: 9 months ago
Short Description
A docker image with openjdk 8 jre and wkhtmltopdf
Full Description


A docker image with openjdk 8 jre and wkhtmltopdf

With this docker image you have both openjdk jre 8 and wkhtmltopdf available (that's what I need now). Wkhtmltopdf is downloaded automatically from the official binaries during the build.

Why not use the debian provided wkhtmltopdf package?

Because Debian jessie, the base image for openjdk images, has some problems with the included wkhtmltopdf ("QXcbConnection: Could not connect to display" error).

Why not use jre-alpine as a base?

I've make a five minutes try with oraclejdk-alpine as a base without success due to a docker bug.

So, I've tried porting the Docker-Alpine-wkhtmltopdf method (wkhtmltopdf compilation from source) with a oraclejdk-alpine base image: the build was failing because initially some dependencies weren't found in /alpine/edge/testing:

ERROR: unsatisfiable constraints:
  fonts-base (missing):
     required by: world[fonts-base]
  fonts-extra (missing):
     required by: world[fonts-extra]

Then I've found a way (see notes above) to build wkhtmltopdf from sources on oraclejdk-alpine base image, but the build take a very long time to complete.

Using (today) the Alpine provided package is also unuseful, because, like Debian, the Alpine included package doesn't works as expected.
Somebody also ended including a custom built binary but from my point of view this is not very security-friendly.



You can use this as a base image for your images, e.g.:

FROM lifeisfoo/docker-java-wkhtmltopdf

COPY build/libs/your-application-all.jar / 
CMD java -jar your-application-all.jar

So your application can use the command to generate pdf the code.


You can use it as a standalone image for creating pdf directly from files:

echo "<h1>Hello</h1><i>world</i>" > hello.html
docker run -v `pwd`:/pages lifeisfoo/docker-java-wkhtmltopdf wkhtmltopdf file:///pages/hello.html - > hello.pdf

Or from URLs:

docker run lifeisfoo/docker-java-wkhtmltopdf wkhtmltopdf - > github.pdf



§ It is possible to manually add single fonts as dependencies because fonts-base and fonts-extra was only meta-packages:

Docker Pull Command

Comments (0)