如何安装和运行 wkhtmltopdf Docker 镜像 [英] How to install and run wkhtmltopdf Docker image

查看:239
本文介绍了如何安装和运行 wkhtmltopdf Docker 镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在构建和运行 Spring- 应用程序的 Dockerfile 中安装和运行 wkhtmltopdf启动 应用程序.我已经在 Dockerfile 中编写了以下给定的脚本来安装 wkhtmltopdf.

I want to install and run wkhtmltopdf from Dockerfile of Spring-Boot application when I will build and run the Spring-boot application. I have written the below given scripts in Dockerfile to install wkhtmltopdf.

FROM debian:jessie

RUN apt-get update \
    && apt-get install -y \
        curl \
        libxrender1 \
        libfontconfig \
        libxtst6 \
        xz-utils

RUN curl "https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz" -L -o "wkhtmltopdf.tar.xz"
RUN tar Jxvf wkhtmltopdf.tar.xz
RUN mv wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf

ENTRYPOINT ["wkhtmltopdf"]

上述脚本创建了一个 docker 镜像,但是如何运行这些镜像来测试 wkhtmltopdf 是否正常工作?或者我们必须安装的任何其他方法 &从 Dockerfile 运行 wkhtmltopdf?

The above scripts created a docker images, but how to run those images to test wkhtmltopdf is working or not? Or Any other approach we have to install & run wkhtmltopdf from Dockerfile?

推荐答案

另一个简单的答案:

# Create image based on the official openjdk 8-jre-alpine image from the dockerhub
FROM openjdk:8-jre-alpine

# Install wkhtmltopdf
RUN apk add --no-cache wkhtmltopdf

ENTRYPOINT ["wkhtmltopdf"]

这篇关于如何安装和运行 wkhtmltopdf Docker 镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆