Laradock如何使用APK而不是APT-GET添加软件包

发布于 2025-02-01 11:44:04 字数 10193 浏览 2 评论 0原文

我正在使用Laradock来部署Laravel应用程序。

我面临着生成PDF文件以将其连接到排队中的电子邮件中的问题。待处理的作业是由php-worker容器处理的。

问题是,当您要将PDF附加到电子邮件时,该电子邮件已排队(因此,由php-worker容器处理),我会收到以下错误:

“ sh:/usr/local/bin/wkhtmltopdf:找不到

这意味着wkhtmltopdf in php-worker容器中未安装wkhtmltopdf

#####################################
# wkhtmltopdf:
#####################################

USER root

ARG INSTALL_WKHTMLTOPDF=false

RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
    apt-get install -yqq \
      libxrender1 \
      libfontconfig1 \
      libx11-dev \
      libjpeg62 \
      libxtst6 \
      fontconfig \
      libjpeg62-turbo \
      xfonts-base \
      xfonts-75dpi \
      wget \
    && wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_amd64.deb \
    && dpkg -i wkhtmltox_0.12.6-1.stretch_amd64.deb \
    && apt -f install \
;fi

如果我将该安装代码复制到 php-worker 容器,我会收到以下错误

/bin/sh:apt-get:找不到

,进一步搜索,似乎 PHP-worker容器是基于Alpine的,由于Alpine而可能需要APK添加

我尝试了以下内容:

#####################################
# wkhtmltopdf:
#####################################

USER root

ARG INSTALL_WKHTMLTOPDF=false

RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
    apk add --no-cache \
      libxrender1 \
      libfontconfig1 \
      libx11-dev \
      libjpeg62 \
      libxtst6 \
      fontconfig \
      libjpeg62-turbo \
      xfonts-base \
      xfonts-75dpi \
      wget \
      wkhtmltopdf \
;fi

但是我没有运气。

错误:无法选择软件包:wkhtmltopdf(否这样的软件包):要求:world [wkhtmltopdf]

我一直在编辑基于此链接 dockerfile ,这是我到目前为止修改的: dockerfile

#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#

ARG LARADOCK_PHP_VERSION
FROM php:${LARADOCK_PHP_VERSION}-alpine3.14

LABEL maintainer="Mahmoud Zalt <[email protected]>"

ARG LARADOCK_PHP_VERSION

# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.

ARG CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then \
  # Change application source from dl-cdn.alpinelinux.org to aliyun source
  sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
  ;fi

RUN apk --update add wget \
  curl \
  git \
  build-base \
  libmcrypt-dev \
  libxml2-dev \
  linux-headers \
  pcre-dev \
  zlib-dev \
  autoconf \
  cyrus-sasl-dev \
  libgsasl-dev \
  oniguruma-dev \
  libressl \
  libressl-dev \
  supervisor

# ...................

#####################################
# wkhtmltopdf:
#####################################

USER root

ARG INSTALL_WKHTMLTOPDF=false

RUN set -xe; \
if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
# Install dependencies for wkhtmltopdf
  apk add --update --no-cache --wait 10 \
  && apk --no-cache upgrade \
  && apk add --no-cache \
  bash \
  libstdc++ \
  libx11 \
  libxrender \
  libxext \
  libssl1.1 \
  ca-certificates \
  fontconfig \
  freetype \
  ttf-dejavu \
  ttf-droid \
  ttf-freefont \
  ttf-liberation \
  xvfb \
  #libQt5WebKit \ This throws error. Commented out.
  #libQt5WebKitWidgets \ This throws error. Commented out.
  #ttf-ubuntu-font-family \ This throws error. Commented out.
  && apk add --update --no-cache --virtual .build-deps \
  msttcorefonts-installer \
  vim \
\
# Install microsoft fonts
&& update-ms-fonts \
&& fc-cache -f \
\
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps \

   && wget http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/wkhtmltopdf-0.12.6-r0.apk \
   && apk add --allow-untrusted wkhtmltopdf-0.12.6-r0.apk \
   && echo 'WKHTMLTOPDF INSTALLED?' \
   && which wkhtmltopdf \
#   && ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf \
   && cp /usr/bin/wkhtmltoimage /usr/local/bin/ \
   && cp /usr/bin/wkhtmltopdf /usr/local/bin/  \
   && chmod +x /usr/local/bin/wkhtmltoimage \
   && chmod +x /usr/local/bin/wkhtmltopdf \
   && echo 'wkhtmltopdf version: ' \
   && /usr/local/bin/wkhtmltopdf -V \
   && echo 'whoami & permissions'  \
   && whoami \
   && ls -lah /usr/bin/ \
   && ls -lah /usr/local/bin/ \

;fi


#
#-----------------------------
# Set PHP memory_limit to infinity
#-------------------------------
#

RUN echo 'set php memory to -1:' \
&& sed -i 's/memory_limit = .*/memory_limit=-1 /' /usr/local/etc/php/php.ini-production  \
&& sed -i 's/memory_limit = .*/memory_limit=-1 /' /usr/local/etc/php/php.ini-development \
&& cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini


# ...

最后,wkhtmltopdf 似乎要安装

+ apk add --allow-untrusted wkhtmltopdf-0.12.6-r0.apk
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/43) Installing icu-libs (67.1-r2)
(2/43) Installing libpcre2-16 (10.36-r0)
(3/43) Installing qt5-qtbase (5.15.3_git20210406-r0)
(4/43) Installing hicolor-icon-theme (0.17-r1)
(5/43) Installing wayland-libs-server (1.19.0-r0)
(6/43) Installing mesa-gbm (21.1.2-r0)
(7/43) Installing wayland-libs-client (1.19.0-r0)
(8/43) Installing qt5-qtdeclarative (5.15.3_git20210531-r0)
(9/43) Installing libxcomposite (0.4.5-r0)
(10/43) Installing wayland-libs-cursor (1.19.0-r0)
(11/43) Installing wayland-libs-egl (1.19.0-r0)
(12/43) Installing libxkbcommon (1.2.1-r0)
(13/43) Installing qt5-qtwayland (5.15.3_git20210510-r0)
(14/43) Installing mesa-egl (21.1.2-r0)
(15/43) Installing libevdev (1.11.0-r1)
(16/43) Installing mtdev (1.1.6-r0)
(17/43) Installing eudev-libs (3.2.10-r0)
(18/43) Installing libinput-libs (1.18.0-r0)
(19/43) Installing xcb-util-wm (0.4.1-r1)
(20/43) Installing xcb-util (0.4.0-r3)
(21/43) Installing xcb-util-image (0.4.0-r1)
(22/43) Installing xcb-util-keysyms (0.4.0-r1)
(23/43) Installing xcb-util-renderutil (0.3.9-r1)
(24/43) Installing libxkbcommon-x11 (1.2.1-r0)
(25/43) Installing qt5-qtbase-x11 (5.15.3_git20210406-r0)
(26/43) Installing qt5-qtsvg (5.15.3_git20200406-r0)
(27/43) Installing qt5-qtlocation (5.15.3_git20201109-r0)
(28/43) Installing qt5-qtsensors (5.15.3_git20201028-r1)
(29/43) Installing qt5-qtwebchannel (5.15.3_git20201028-r0)
(30/43) Installing libxv (1.0.11-r2)
(31/43) Installing alsa-lib (1.2.5-r2)
(32/43) Installing cdparanoia-libs (10.2-r9)
(33/43) Installing gstreamer (1.18.4-r0)
(34/43) Installing libogg (1.3.5-r0)
(35/43) Installing opus (1.3.1-r1)
(36/43) Installing orc (0.4.32-r0)
(37/43) Installing libtheora (1.1.1-r16)
(38/43) Installing libvorbis (1.3.7-r0)
(39/43) Installing gst-plugins-base (1.18.4-r0)
(40/43) Installing hyphen (2.8.8-r1)
(41/43) Installing libxslt (1.1.35-r0)
(42/43) Installing qt5-qtwebkit (5.212.0_alpha4-r14)
(43/43) Installing wkhtmltopdf (0.12.6-r0)
Executing busybox-1.33.1-r7.trigger
OK: 877 MiB in 254 packages
WKHTMLTOPDF INSTALLED?
+ echo 'WKHTMLTOPDF INSTALLED?'
+ which wkhtmltopdf
/usr/bin/wkhtmltopdf
+ cp /usr/bin/wkhtmltoimage /usr/local/bin/
+ cp /usr/bin/wkhtmltopdf /usr/local/bin/
+ chmod +x /usr/local/bin/wkhtmltoimage
+ chmod +x /usr/local/bin/wkhtmltopdf
+ echo 'wkhtmltopdf version: '
+ /usr/local/bin/wkhtmltopdf -V
wkhtmltopdf version: 
wkhtmltopdf 0.12.6

+ echo 'whoami & permissions'
+ whoami
whoami & permissions
root
+ ls -lah /usr/bin/
-rwxr-xr-x    1 root     root         979 Jun  1  2021 supervisorctl
-rwxr-xr-x    1 root     root         975 Jun  1  2021 supervisord
-rwxr-xr-x    1 root     root      114.1K Jun 11  2020 wkhtmltoimage
-rwxr-xr-x    1 root     root      162.1K Jun 11  2020 wkhtmltopdf
+ ls -lah /usr/local/bin/
-rwxr-xr-x    1 root     root      114.1K May 25 16:37 wkhtmltoimage
-rwxr-xr-x    1 root     root      162.1K May 25 16:37 wkhtmltopdf

Step 82/86 : COPY supervisord.conf /etc/supervisord.conf
 ---> de059f102569
Step 83/86 : ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c",  "/etc/supervisord.conf"]

,但是当我尝试执行容器以验证该容器时, wkhtmltopdf确实已经安装了,

❯ docker container exec php-worker /usr/local/bin/wkhtmltopdf -V                                                                                                        ─╯
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/usr/local/bin/wkhtmltopdf": stat /usr/local/bin/wkhtmltopdf: no such file or directory: unknown

事实证明它没有安装!,因此,我在应用程序中遇到了完全相同的错误:

“ sh:/usr/local/bin/wkhtmltopdf:找不到

,另一方面,主管确实有效:

❯ docker container exec php-worker supervisorctl                                                                                                                        ─╯
laravel-scheduler:laravel-scheduler_00   RUNNING   pid 52576, uptime 18:27:24
laravel-worker:laravel-worker_00         RUNNING   pid 52577, uptime 18:27:24

supervisor> 

是否有人知道如何在Alpine Dockerfile中安装WKHTMLTOPDF?

I am using Laradock to deploy a Laravel app.

I am facing a problem with generating a PDF file to attach it in an email in a queued job. The pending jobs are handle by the php-worker container.

The problem is that when you want to attach a PDF to an email, which is queued (therefore, handled by the php-worker container) I get the following error:

"sh: /usr/local/bin/wkhtmltopdf: not found

which means that the wkhtmltopdf is not installed in the php-worker container.

So, taking a look at either the php-fpm or workspace Dockerfile, I can see how to install the wkhtmltopdf like so:

#####################################
# wkhtmltopdf:
#####################################

USER root

ARG INSTALL_WKHTMLTOPDF=false

RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
    apt-get install -yqq \
      libxrender1 \
      libfontconfig1 \
      libx11-dev \
      libjpeg62 \
      libxtst6 \
      fontconfig \
      libjpeg62-turbo \
      xfonts-base \
      xfonts-75dpi \
      wget \
    && wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_amd64.deb \
    && dpkg -i wkhtmltox_0.12.6-1.stretch_amd64.deb \
    && apt -f install \
;fi

If I copy that installation code into the php-worker container, I get the following error

/bin/sh: apt-get: not found

So, searching further, it seems the php-worker container is Alpine based, and probably needs apk add because of Alpine.

I have tried the following:

#####################################
# wkhtmltopdf:
#####################################

USER root

ARG INSTALL_WKHTMLTOPDF=false

RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
    apk add --no-cache \
      libxrender1 \
      libfontconfig1 \
      libx11-dev \
      libjpeg62 \
      libxtst6 \
      fontconfig \
      libjpeg62-turbo \
      xfonts-base \
      xfonts-75dpi \
      wget \
      wkhtmltopdf \
;fi

But I haven't got luck.

ERROR: unable to select packages: wkhtmltopdf (no such package): required by: world[wkhtmltopdf]

I have been editing the Dockerfile based on this link and this is what I've modified so far:
Dockerfile

#
#--------------------------------------------------------------------------
# Image Setup
#--------------------------------------------------------------------------
#

ARG LARADOCK_PHP_VERSION
FROM php:${LARADOCK_PHP_VERSION}-alpine3.14

LABEL maintainer="Mahmoud Zalt <[email protected]>"

ARG LARADOCK_PHP_VERSION

# If you're in China, or you need to change sources, will be set CHANGE_SOURCE to true in .env.

ARG CHANGE_SOURCE=false
RUN if [ ${CHANGE_SOURCE} = true ]; then \
  # Change application source from dl-cdn.alpinelinux.org to aliyun source
  sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \
  ;fi

RUN apk --update add wget \
  curl \
  git \
  build-base \
  libmcrypt-dev \
  libxml2-dev \
  linux-headers \
  pcre-dev \
  zlib-dev \
  autoconf \
  cyrus-sasl-dev \
  libgsasl-dev \
  oniguruma-dev \
  libressl \
  libressl-dev \
  supervisor

# ...................

#####################################
# wkhtmltopdf:
#####################################

USER root

ARG INSTALL_WKHTMLTOPDF=false

RUN set -xe; \
if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \
# Install dependencies for wkhtmltopdf
  apk add --update --no-cache --wait 10 \
  && apk --no-cache upgrade \
  && apk add --no-cache \
  bash \
  libstdc++ \
  libx11 \
  libxrender \
  libxext \
  libssl1.1 \
  ca-certificates \
  fontconfig \
  freetype \
  ttf-dejavu \
  ttf-droid \
  ttf-freefont \
  ttf-liberation \
  xvfb \
  #libQt5WebKit \ This throws error. Commented out.
  #libQt5WebKitWidgets \ This throws error. Commented out.
  #ttf-ubuntu-font-family \ This throws error. Commented out.
  && apk add --update --no-cache --virtual .build-deps \
  msttcorefonts-installer \
  vim \
\
# Install microsoft fonts
&& update-ms-fonts \
&& fc-cache -f \
\
# Clean up when done
&& rm -rf /tmp/* \
&& apk del .build-deps \

   && wget http://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/wkhtmltopdf-0.12.6-r0.apk \
   && apk add --allow-untrusted wkhtmltopdf-0.12.6-r0.apk \
   && echo 'WKHTMLTOPDF INSTALLED?' \
   && which wkhtmltopdf \
#   && ln -s /usr/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf \
   && cp /usr/bin/wkhtmltoimage /usr/local/bin/ \
   && cp /usr/bin/wkhtmltopdf /usr/local/bin/  \
   && chmod +x /usr/local/bin/wkhtmltoimage \
   && chmod +x /usr/local/bin/wkhtmltopdf \
   && echo 'wkhtmltopdf version: ' \
   && /usr/local/bin/wkhtmltopdf -V \
   && echo 'whoami & permissions'  \
   && whoami \
   && ls -lah /usr/bin/ \
   && ls -lah /usr/local/bin/ \

;fi


#
#-----------------------------
# Set PHP memory_limit to infinity
#-------------------------------
#

RUN echo 'set php memory to -1:' \
&& sed -i 's/memory_limit = .*/memory_limit=-1 /' /usr/local/etc/php/php.ini-production  \
&& sed -i 's/memory_limit = .*/memory_limit=-1 /' /usr/local/etc/php/php.ini-development \
&& cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini


# ...

Finally, the wkhtmltopdf seems to be installed:

+ apk add --allow-untrusted wkhtmltopdf-0.12.6-r0.apk
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/43) Installing icu-libs (67.1-r2)
(2/43) Installing libpcre2-16 (10.36-r0)
(3/43) Installing qt5-qtbase (5.15.3_git20210406-r0)
(4/43) Installing hicolor-icon-theme (0.17-r1)
(5/43) Installing wayland-libs-server (1.19.0-r0)
(6/43) Installing mesa-gbm (21.1.2-r0)
(7/43) Installing wayland-libs-client (1.19.0-r0)
(8/43) Installing qt5-qtdeclarative (5.15.3_git20210531-r0)
(9/43) Installing libxcomposite (0.4.5-r0)
(10/43) Installing wayland-libs-cursor (1.19.0-r0)
(11/43) Installing wayland-libs-egl (1.19.0-r0)
(12/43) Installing libxkbcommon (1.2.1-r0)
(13/43) Installing qt5-qtwayland (5.15.3_git20210510-r0)
(14/43) Installing mesa-egl (21.1.2-r0)
(15/43) Installing libevdev (1.11.0-r1)
(16/43) Installing mtdev (1.1.6-r0)
(17/43) Installing eudev-libs (3.2.10-r0)
(18/43) Installing libinput-libs (1.18.0-r0)
(19/43) Installing xcb-util-wm (0.4.1-r1)
(20/43) Installing xcb-util (0.4.0-r3)
(21/43) Installing xcb-util-image (0.4.0-r1)
(22/43) Installing xcb-util-keysyms (0.4.0-r1)
(23/43) Installing xcb-util-renderutil (0.3.9-r1)
(24/43) Installing libxkbcommon-x11 (1.2.1-r0)
(25/43) Installing qt5-qtbase-x11 (5.15.3_git20210406-r0)
(26/43) Installing qt5-qtsvg (5.15.3_git20200406-r0)
(27/43) Installing qt5-qtlocation (5.15.3_git20201109-r0)
(28/43) Installing qt5-qtsensors (5.15.3_git20201028-r1)
(29/43) Installing qt5-qtwebchannel (5.15.3_git20201028-r0)
(30/43) Installing libxv (1.0.11-r2)
(31/43) Installing alsa-lib (1.2.5-r2)
(32/43) Installing cdparanoia-libs (10.2-r9)
(33/43) Installing gstreamer (1.18.4-r0)
(34/43) Installing libogg (1.3.5-r0)
(35/43) Installing opus (1.3.1-r1)
(36/43) Installing orc (0.4.32-r0)
(37/43) Installing libtheora (1.1.1-r16)
(38/43) Installing libvorbis (1.3.7-r0)
(39/43) Installing gst-plugins-base (1.18.4-r0)
(40/43) Installing hyphen (2.8.8-r1)
(41/43) Installing libxslt (1.1.35-r0)
(42/43) Installing qt5-qtwebkit (5.212.0_alpha4-r14)
(43/43) Installing wkhtmltopdf (0.12.6-r0)
Executing busybox-1.33.1-r7.trigger
OK: 877 MiB in 254 packages
WKHTMLTOPDF INSTALLED?
+ echo 'WKHTMLTOPDF INSTALLED?'
+ which wkhtmltopdf
/usr/bin/wkhtmltopdf
+ cp /usr/bin/wkhtmltoimage /usr/local/bin/
+ cp /usr/bin/wkhtmltopdf /usr/local/bin/
+ chmod +x /usr/local/bin/wkhtmltoimage
+ chmod +x /usr/local/bin/wkhtmltopdf
+ echo 'wkhtmltopdf version: '
+ /usr/local/bin/wkhtmltopdf -V
wkhtmltopdf version: 
wkhtmltopdf 0.12.6

+ echo 'whoami & permissions'
+ whoami
whoami & permissions
root
+ ls -lah /usr/bin/
-rwxr-xr-x    1 root     root         979 Jun  1  2021 supervisorctl
-rwxr-xr-x    1 root     root         975 Jun  1  2021 supervisord
-rwxr-xr-x    1 root     root      114.1K Jun 11  2020 wkhtmltoimage
-rwxr-xr-x    1 root     root      162.1K Jun 11  2020 wkhtmltopdf
+ ls -lah /usr/local/bin/
-rwxr-xr-x    1 root     root      114.1K May 25 16:37 wkhtmltoimage
-rwxr-xr-x    1 root     root      162.1K May 25 16:37 wkhtmltopdf

Step 82/86 : COPY supervisord.conf /etc/supervisord.conf
 ---> de059f102569
Step 83/86 : ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c",  "/etc/supervisord.conf"]

BUT when I try to execute the container to verify that the wkhtmltopdf is indeed installed,

❯ docker container exec php-worker /usr/local/bin/wkhtmltopdf -V                                                                                                        ─╯
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "/usr/local/bin/wkhtmltopdf": stat /usr/local/bin/wkhtmltopdf: no such file or directory: unknown

turns out that it's not been installed! And therefore, I get the exact same error in my application:

"sh: /usr/local/bin/wkhtmltopdf: not found

And, on the other hand, for example, the supervisor does work:

❯ docker container exec php-worker supervisorctl                                                                                                                        ─╯
laravel-scheduler:laravel-scheduler_00   RUNNING   pid 52576, uptime 18:27:24
laravel-worker:laravel-worker_00         RUNNING   pid 52577, uptime 18:27:24

supervisor> 

Does anybody know how to install wkhtmltopdf in Alpine Dockerfile for real?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

森林迷了鹿 2025-02-08 11:44:04

您使用的PHP图像构建在Alpine 3.15上;它看起来像wkhtmltopdf在Alpine版本中不是包装:

$ docker run --rm alpine:3.15 sh -c 'apk add --update wkhtmltopdf'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
  wkhtmltopdf (no such package):
    required by: world[wkhtmltopdf]

它看起来像wkhtmltopdf仅在3.14和更早的时间内可用(i
检查了3.14和3.13):

$ docker run --rm alpine:3.14 sh -c 'apk add --update wkhtmltopdf'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/103) Installing dbus-libs (1.12.20-r2)
(2/103) Installing libgcc (10.3.1_git20210424-r2)
[...]
(103/103) Installing wkhtmltopdf (0.12.6-r0)
Executing busybox-1.33.1-r7.trigger
OK: 196 MiB in 117 packages

由于缺乏上游支撑而被删除

QT5-QTWEBKIT,KDEWEBKIT,WKHTMLTOPDF和PY3-PDFKIT已因已知漏洞而被删除,并且缺乏对QTWebKit的上游支持。在适当的情况下,已经对其他程序进行了调整以使用QT5-qtwebengine。 WKHTMLTOPDF的最直接替换是Weasyprint,它可在Alpine Linux社区存储库中使用。根据您的需求,木偶和潘多克也是选择。有关更多信息,请参见#12888。


您可以使用上游dockerfile dry在较旧的高山释放上构建自己的PHP基本图像。 ,或者您可以尝试从Vanilla Alpine开始:3.14图像>使用apk安装PHP。

或只是坚持使用基于Ubuntu的图像,该图像仍然包装
wkhtmltopdf

The PHP images you're using are built on Alpine 3.15; it looks like wkhtmltopdf isn't package in that version of Alpine:

$ docker run --rm alpine:3.15 sh -c 'apk add --update wkhtmltopdf'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
  wkhtmltopdf (no such package):
    required by: world[wkhtmltopdf]

It looks like wkhtmltopdf is only available in 3.14 and earlier (I
checked 3.14 and 3.13):

$ docker run --rm alpine:3.14 sh -c 'apk add --update wkhtmltopdf'
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/103) Installing dbus-libs (1.12.20-r2)
(2/103) Installing libgcc (10.3.1_git20210424-r2)
[...]
(103/103) Installing wkhtmltopdf (0.12.6-r0)
Executing busybox-1.33.1-r7.trigger
OK: 196 MiB in 117 packages

This is noted in the release notes for 3.15, which say:

QtWebKit was removed due to lack of upstream support

qt5-qtwebkit, kdewebkit, wkhtmltopdf, and py3-pdfkit have been removed due to known vulnerabilities and lack of upstream support for qtwebkit. Other programs have been adjusted to use qt5-qtwebengine where appropriate. The most direct replacement for wkhtmltopdf is weasyprint, which is available in the Alpine Linux community repository. puppeteer and pandoc are also options, depending on your needs. See #12888 for more information.

You could dry building your own PHP base image on top of an older Alpine release using the upstream Dockerfile, or you could try starting with the vanilla alpine:3.14 image and installing php using apk.

Or just stick with an Ubuntu-based image, which still packages
wkhtmltopdf.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文