Lau*_*Lau 10 wkhtmltopdf docker alpine-linux
我使用以下命令在 Alpine Docker 上安装了 Wkhtmltopdf:
apk add --no-cache wkhtmltopdf
但是,当我尝试运行 wkhtmltopdf 时,我得到:
/usr/bin/wkhtmltopdf "test.html" "test.pdf"
Cannot mix incompatible Qt library (version 0x50c03) with this library (version 0x50c00)
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
编辑:
似乎问题是其他一些软件包安装了不兼容的 qt 版本。这是我的 Dockerfile:
RUN apk --no-cache update \
&& apk --no-cache upgrade \
&& apk add --no-cache \
mysql-client \
php7-mysqli \
php7-pdo \
freetype \
libpng \
freetype-dev \
libpng-dev \
jpeg-dev \
libjpeg \
libjpeg-turbo-dev \
wget \
zlib-dev \
ttf-freefont \
fontconfig \
xvfb \
libxrender-dev \
gettext \
gettext-dev \
libxml2-dev \
gnu-libiconv-dev \
autoconf \
g++ \
git \
bash \
wkhtmltopdf
Run Code Online (Sandbox Code Playgroud)
从 3.15 版本开始,您无法从 alpine 存储库安装 wkhtmltopdf https://pkgs.alpinelinux.org/packages?name=wkhtmltopdf&branch=edge&repo=&arch=&maintainer=
如果你想在较新的 alpine 中使用 wkhtmltopdf(下面的 3.17)。您可以从其他镜像(例如https://github.com/Surnet/docker-wkhtmltopdf)复制 bin 文件并安装相关库。
这是 Dockerfile:
FROM surnet/alpine-wkhtmltopdf:3.16.2-0.12.6-full as wkhtmltopdf
FROM php:8.2-fpm-alpine3.17 AS app
# wkhtmltopdf install dependencies
RUN apk add --no-cache \
libstdc++ \
libx11 \
libxrender \
libxext \
libssl1.1 \
ca-certificates \
fontconfig \
freetype \
ttf-droid \
ttf-freefont \
ttf-liberation \
# more fonts
;
# wkhtmltopdf copy bins from ext image
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/libwkhtmltox.so /bin/
# install php extensions, apache/nginx etc.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20378 次 |
| 最近记录: |