I have an existing php:8-fpm-alpine Dockerfile, and i need to add WKHTMLTOPDF package. Is that even possible. I tried using following dockerfile, but i get following error log:
Dockerfile…
FROM php:8-fpm-alpine
...
RUN apk add xvfb libfontconfig wkhtmltopdf
error:
ERROR [ 8/13] RUN apk add --no-cache wkhtmltopdf 2.1s
[ 8/13] RUN apk add --no-cache wkhtmltopdf:
#12 0.567 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
#12 1.097 fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
#12 2.001 ERROR: unable to select packages:
#12 2.034 wkhtmltopdf (no such package):
#12 2.034 required by: world[wkhtmltopdf]
executor failed running [/bin/sh -c apk add --no-cache wkhtmltopdf]: exit code: 1
ERROR: Service 'php' failed to build : Build failed
I tried including contents from following repository, but i think its way too much work for 1 package, and it breaks in build process:
https://github.com/alloylab/Docker-Alpine-wkhtmltopdf
Any help would be appreciated.
3
Answers
I faced a similar problem with
php:7.4-fpm-alpine
image.It seems like
wkhtmltopdf
is missing in Alpine v.3.15, but it is available in v.3.14.Try to change
to
I had the same problem when trying to update to
php:8.1.9-fpm-alpine3.16
To get this to work I added a link to the community 3.14 repository for wkhtmltopdf. It turned out it had some dependencies from the main repository also :
So you need to add that aswell
My modern approach using surnet/alpine-wkhtmltopdf image
Goals:
Dockerfile:
alpine-wkhtmltopdf
imagePartially based on manual