wkhtmltopdf Docker 이미지 설치 및 실행 방법
wkhtmltopdf를 설치하고 실행하고 싶습니다.Dockerfile
의Spring-Boot
애플리케이션을 구축하고 실행할 때Spring-boot
어플.아래 주어진 스크립트를 작성했습니다.Dockerfile
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"]
위의 스크립트는 도커 이미지를 생성했지만, wkhtmltopdf가 작동하는지 테스트하기 위해 이러한 이미지를 실행하는 방법은 무엇입니까?또는 wkhtmltopdf에서 설치하고 실행해야 하는 다른 접근 방식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가 /usr/bin/wkhtmltopdf에 설치됩니다.
RUN apt-get update \
&& apt-get install -y \
...
wkhtmltopdf \
...
# (Multi stage Docker can be considered. The appropriate Gradle cache use remains to be solved)
# Create image based on the official openjdk 11-jre-slim image from the dockerhub
FROM debian:jessie
ENV DIR=/usr/local/bin/
# Change directory so that our commands run inside this new directory
WORKDIR $DIR
ENV WKHTML_VERSION 0.12.4
# Builds the wkhtmltopdf download URL based on version number above
ENV DOWNLOAD_URL "https://downloads.wkhtmltopdf.org/0.12/${WKHTML_VERSION}/wkhtmltox-${WKHTML_VERSION}_linux-generic-amd64.tar.xz" -L -o "wkhtmltopdf.tar.xz"
# Install dependencies
RUN apt-get update && apt-get install -y \
curl libxrender1 libfontconfig libxtst6 xz-utils
# Download and extract wkhtmltopdf
RUN curl $DOWNLOAD_URL
RUN tar Jxvf wkhtmltopdf.tar.xz
RUN cp wkhtmltox/bin/wkhtmltopdf $DIR
ENTRYPOINT ["wkhtmltopdf"]
언급URL : https://stackoverflow.com/questions/62589478/how-to-install-and-run-wkhtmltopdf-docker-image
'programing' 카테고리의 다른 글
Powershell: 존재하지 않을 수 있는 경로를 확인하시겠습니까? (0) | 2023.07.24 |
---|---|
Node.js - 현재 파일 이름 가져오기 (0) | 2023.07.24 |
영숫자가 아닌 모든 문자, 새 줄 및 여러 공백을 하나의 공백으로 바꾸기 (0) | 2023.07.24 |
Angular2 코드의 TypeScript 오류: 'module' 이름을 찾을 수 없습니다. (0) | 2023.07.24 |
HTML 특수 문자를 제거하는 방법은 무엇입니까? (0) | 2023.07.24 |