Skip to content

Instantly share code, notes, and snippets.

@jtraulle
Created January 17, 2018 10:26
Show Gist options
  • Save jtraulle/671bb0079e78271765daa28af1a240ac to your computer and use it in GitHub Desktop.
Save jtraulle/671bb0079e78271765daa28af1a240ac to your computer and use it in GitHub Desktop.
Alpine linux wkhtml2pdf
FROM alpine:3.3
RUN apk add --no-cache \
xvfb \
# Additionnal dependencies for better rendering
ttf-freefont \
fontconfig \
dbus \
&& \
# Install wkhtmltopdf from `testing` repository
apk add qt5-qtbase-dev \
wkhtmltopdf \
--no-cache \
--repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \
--allow-untrusted \
&& \
# Wrapper for xvfb
mv /usr/bin/wkhtmltopdf /usr/bin/wkhtmltopdf-origin && \
echo $'#!/usr/bin/env sh\n\
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset & \n\
DISPLAY=:0.0 wkhtmltopdf-origin $@ \n\
killall Xvfb\
' > /usr/bin/wkhtmltopdf && \
chmod +x /usr/bin/wkhtmltopdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment