Browse Source

Merge pull request #2469 from DGeoWils/master

Added wkhtmltopdf installation to both Workspace and PHP-FPM
Shao Yu-Lung (Allen) 5 years ago
parent
commit
9de9e8ed04
5 changed files with 58 additions and 0 deletions
  1. 14 0
      DOCUMENTATION/content/documentation/index.md
  2. 2 0
      docker-compose.yml
  3. 2 0
      env-example
  4. 20 0
      php-fpm/Dockerfile
  5. 20 0
      workspace/Dockerfile

+ 14 - 0
DOCUMENTATION/content/documentation/index.md

@@ -1956,7 +1956,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.
 
 
+<br>
+<a name="Install-wkhtmltopdf"></a>
+## 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.
 
 
 

+ 2 - 0
docker-compose.yml

@@ -140,6 +140,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
@@ -226,6 +227,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}

+ 2 - 0
env-example

@@ -156,6 +156,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
@@ -215,6 +216,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

+ 20 - 0
php-fpm/Dockerfile

@@ -849,6 +849,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:
 ###########################################################################

+ 20 - 0
workspace/Dockerfile

@@ -1239,6 +1239,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:
 ###########################################################################