From 8ecd35d2e9ba7c18de7b281a6287379d806f1fb7 Mon Sep 17 00:00:00 2001 From: Dan Wilson Date: Wed, 15 Jan 2020 12:01:35 -0500 Subject: [PATCH 1/2] Added wkhtmltopdf installation to both Workspace and PHP-FPM --- docker-compose.yml | 2 ++ env-example | 2 ++ php-fpm/Dockerfile | 20 ++++++++++++++++++++ workspace/Dockerfile | 20 ++++++++++++++++++++ 4 files changed, 44 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index fdab1416..c935c83e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -138,6 +138,7 @@ services: - INSTALL_POWERLINE=${WORKSPACE_INSTALL_POWERLINE} - INSTALL_SUPERVISOR=${WORKSPACE_INSTALL_SUPERVISOR} - INSTALL_FFMPEG=${WORKSPACE_INSTALL_FFMPEG} + - INSTALL_WKHTMLTOPDF=${WORKSPACE_INSTALL_WKHTMLTOPDF} - INSTALL_GNU_PARALLEL=${WORKSPACE_INSTALL_GNU_PARALLEL} - http_proxy - https_proxy @@ -217,6 +218,7 @@ services: - INSTALL_PCNTL=${PHP_FPM_INSTALL_PCNTL} - ADDITIONAL_LOCALES=${PHP_FPM_ADDITIONAL_LOCALES} - INSTALL_FFMPEG=${PHP_FPM_FFMPEG} + - INSTALL_WKHTMLTOPDF=${PHP_FPM_INSTALL_WKHTMLTOPDF} - INSTALL_XHPROF=${PHP_FPM_INSTALL_XHPROF} - PUID=${PHP_FPM_PUID} - PGID=${PHP_FPM_PGID} diff --git a/env-example b/env-example index c521fd04..82234e8c 100644 --- a/env-example +++ b/env-example @@ -155,6 +155,7 @@ WORKSPACE_CHROME_DRIVER_VERSION=2.42 WORKSPACE_TIMEZONE=UTC WORKSPACE_SSH_PORT=2222 WORKSPACE_INSTALL_FFMPEG=false +WORKSPACE_INSTALL_WKHTMLTOPDF=false WORKSPACE_INSTALL_GNU_PARALLEL=false WORKSPACE_INSTALL_AST=true WORKSPACE_AST_VERSION=1.0.3 @@ -210,6 +211,7 @@ PHP_FPM_INSTALL_MYSQL_CLIENT=false PHP_FPM_INSTALL_PING=false PHP_FPM_INSTALL_SSHPASS=false PHP_FPM_INSTALL_MAILPARSE=false +PHP_FPM_INSTALL_WKHTMLTOPDF=false PHP_FPM_FFMPEG=false PHP_FPM_ADDITIONAL_LOCALES="es_ES.UTF-8 fr_FR.UTF-8" PHP_FPM_DEFAULT_LOCALE=POSIX diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 74b072ee..24b6c6ec 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -846,6 +846,26 @@ RUN if [ ${INSTALL_FFMPEG} = true ]; then \ apt-get -y install ffmpeg \ ;fi +##################################### +# wkhtmltopdf: +##################################### + +USER root + +ARG INSTALL_WKHTMLTOPDF=false + +RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \ + apt-get install -y \ + libxrender1 \ + libfontconfig1 \ + libx11-dev \ + libjpeg62 \ + libxtst6 \ + wget \ + && wget https://github.com/h4cc/wkhtmltopdf-amd64/blob/master/bin/wkhtmltopdf-amd64?raw=true -O /usr/local/bin/wkhtmltopdf \ + && chmod +x /usr/local/bin/wkhtmltopdf \ +;fi + ########################################################################### # Mailparse extension: ########################################################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 6223e0a2..a5f3d280 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1231,6 +1231,26 @@ RUN if [ ${INSTALL_FFMPEG} = true ]; then \ apt-get -y install ffmpeg \ ;fi +##################################### +# wkhtmltopdf: +##################################### + +USER root + +ARG INSTALL_WKHTMLTOPDF=false + +RUN if [ ${INSTALL_WKHTMLTOPDF} = true ]; then \ + apt-get install -y \ + libxrender1 \ + libfontconfig1 \ + libx11-dev \ + libjpeg62 \ + libxtst6 \ + wget \ + && wget https://github.com/h4cc/wkhtmltopdf-amd64/blob/master/bin/wkhtmltopdf-amd64?raw=true -O /usr/local/bin/wkhtmltopdf \ + && chmod +x /usr/local/bin/wkhtmltopdf \ +;fi + ########################################################################### # Mailparse extension: ########################################################################### From 711b2e7449cbf6e2368cb6a1cd75413929d7a7d1 Mon Sep 17 00:00:00 2001 From: Dan Wilson Date: Wed, 15 Jan 2020 13:44:53 -0500 Subject: [PATCH 2/2] Updated documentation with wkhtmltopdf section --- DOCUMENTATION/content/documentation/index.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index 14d5be03..1cafb334 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -1876,7 +1876,21 @@ To install FFMPEG in the Workspace container **PS** Don't forget to install the binary in the `php-fpm` container too by applying the same steps above to its container, otherwise the you'll get an error when running the `php-ffmpeg` binary. +
+ +## Install wkhtmltopdf +[wkhtmltopdf](https://wkhtmltopdf.org/) is a utility for outputting a PDF from HTML + +To install wkhtmltopdf in the Workspace container + +1 - Open the `.env` file + +2 - Search for the `WORKSPACE_INSTALL_WKHTMLTOPDF` argument under the Workspace Container and set it to `true` + +3 - Re-build the container `docker-compose build workspace` + +**PS** Don't forget to install the binary in the `php-fpm` container too by applying the same steps above to its container, otherwise the you'll get an error when running the `wkhtmltopdf` binary.