0

我已经安装了 wkhtmltopdf(patched qt)0.12.4,它在使用 pdfkit 时会出错。我想安装未打补丁的 qt 版本,因为在我的 localsetup 中没有给我错误

我的码头文件:

FROM python:3
RUN apt-get update
RUN apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig libfontconfig1 libxrender1
RUN curl -L#o wk.tar.xz https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
&& tar xf wk.tar.xz \
&& cp wkhtmltox/bin/wkhtmltopdf /usr/bin \
&& cp wkhtmltox/bin/wkhtmltoimage /usr/bin \
&& rm wk.tar.xz \
&& rm -r wkhtmltox
WORKDIR /app/
COPY . /app
COPY requirements.txt /app

RUN pip install -r requirements.txt


EXPOSE 5000

我的码头工人撰写文件:

version: "3.7"

volumes:
   db_data:

services:
   db:
    image: mysql:5.7.29
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    environment:
       MYSQL_ROOT_PASSWORD: root
       MYSQL_USER: root
       MYSQL_PASSWORD: root
       MYSQL_DATABASE: mycamdata
    volumes:
       - db_data:/var/lib/mysql
    ports:
       - "3306:3306"

   adminer:
      image: adminer
      restart: always
      ports:
        - 8080:8080

   app:
      build: .
      command: python run.py --host=0.0.0.0 --port=5000
      volumes:
         - .:/app
      ports:
         - 5000:5000
      depends_on:
         - db

在尝试创建 pdf 时出现此错误:我认为此错误是因为 wkhtmltopdf(patched qt) 版本与 pdfkit 不兼容。我想安装未打补丁的qt版本

OSError: wkhtmltopdf 报错: Loading pages (1/6) [> ] 0% [======> ] 10% QSslSocket: 无法解析 CRYPTO_num_locks QSslSocket: 无法解析 CRYPTO_set_id_callback QSslSocket: 无法解析 CRYPTO_set_locking_callback QSslSocket: 无法解析 sk_free QSslSocket: 无法解析 sk_num QSslSocket: 无法解析 sk_pop_free QSslSocket: 无法解析 sk_value QSslSocket: 无法解析 SSL_library_init QSslSocket: 无法解析 SSL_load_error_strings QSslSocket: 无法解析 SSLv3_client_method QSslSocket: 无法解析 SSLv23_client_method QSslSocket: 无法解析 SSLv3_server_method QSslSocket: 无法解析 SSLv23_chain_server_method: 无法解析 SSLv23_chain_server_method QSslSocket:cannot resolve OPENSSL_add_all_algorithms_noconf QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf QSslSocket: cannot resolve SSLeay QSslSocket: cannot call unresolved function CRYPTO_num_locks QSslSocket: cannot call unresolved function CRYPTO_set_id_callback QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback QSslSocket: cannot call unresolved function SSL_library_init QSslSocket: cannot call unresolved function SSLv23_client_method QSslSocket:无法调用未解析的函数 sk_num [=======================> ] 38% [================ ==========> ] 45% QSslSocket:无法调用未解析的函数 SSLv23_client_method QSslSocket:无法调用未解析的函数 SSL_library_init QSslSocket:无法调用未解析的函数 SSLv23_client_method QSslSocket:无法调用未解析的函数 SSL_library_init QSslSocket:无法调用未解析的函数 SSLv23_client_method QSslSocket:无法调用未解析的函数 SSL_library_init QSslSocket:无法调用未解析的函数 SSLv23_client_method QSslSocket:无法调用未解析的函数 SSL_library_init [========= ==================================================== =] 100% 计数页数 (2/6)
[================================================== ===========] 对象 1 的 1 解决链接 (4/6)
[========================== ===================================] Object 1 of 1 加载页眉和页脚 (5/6)
打印页面(6/6) [>] 准备 [======================================== ====================] 第 1 页,共 1 页 Done
由于网络错误,使用代码 1 退出:UnknownNetworkError QSslSocket:无法调用未解析的函数 CRYPTO_num_locks QSslSocket:无法调用未解析的函数 CRYPTO_set_id_callback QSslSocket:无法调用未解析的函数 CRYPTO_set_locking_callback


4

1 回答 1

0

我通过将下一行添加到基于 Debian Buster 图像的 dockerfile 来解决(wkhtmlto* 版本 0.12.6-1,2021 年 6 月)

RUN apt-get update -qq && apt-get install -y \
    # packages required by wkhtmlto*:
    xfonts-base \
    xfonts-75dpi \
    pdftk # -> only if needed... \
    # ...other custom packages...

RUN curl -L#o wkhtmltopdf.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
RUN dpkg -i wkhtmltopdf.deb; apt-get install -y -f

# Remember to clean your package manager cache to reduce your custom image size...
RUN apt-get clean all \
    && rm -rvf /var/lib/apt/lists/*

你可以在这里找到相同包的其他版本: https ://github.com/wkhtmltopdf/packaging/releases/0.12.6-1

于 2021-06-30T13:36:44.177 回答