From 073822c47484bb864e6c57a8ada5533564c1eef2 Mon Sep 17 00:00:00 2001 From: jurgenhaas <juergen@paragon-es.de> Date: Thu, 13 Sep 2018 15:21:09 +0200 Subject: [PATCH] #26 Add new feature to support wkhtmltox --- src/Handler.php | 6 ++++++ templates/docker-compose.yml.twig | 3 +++ templates/wkhtmltox.sh.twig | 12 ++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 templates/wkhtmltox.sh.twig diff --git a/src/Handler.php b/src/Handler.php index 0410ca3..570b686 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -237,6 +237,9 @@ class Handler { 'dest' => $projectRoot . '/drush', 'add2yaml' => TRUE, ], + 'wkhtmltox.sh' => [ + 'dest' => $projectRoot . '/.docker-init', + ] ]; } @@ -325,6 +328,9 @@ class Handler { 'webgrind' => [ 'enable' => 0, ], + 'wkhtmltox' => [ + 'enable' => 0, + ], ], $extra['docker4drupal']); return $options; } diff --git a/templates/docker-compose.yml.twig b/templates/docker-compose.yml.twig index c56e112..8a7421d 100644 --- a/templates/docker-compose.yml.twig +++ b/templates/docker-compose.yml.twig @@ -48,6 +48,9 @@ services: {% endif %} {% if webgrind.enable %} - files:/mnt/files +{% endif %} +{% if wkhtmltox.enable %} + - './.docker-init/wkhtmltox.sh:/docker-entrypoint-init.d/50-wkhtmltox.sh' {% endif %} extra_hosts: - '{{ projectname }}.docker.localhost:{{ docker0.ip }}' diff --git a/templates/wkhtmltox.sh.twig b/templates/wkhtmltox.sh.twig new file mode 100644 index 0000000..0e9c723 --- /dev/null +++ b/templates/wkhtmltox.sh.twig @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +apk add --no-cache xvfb ttf-freefont fontconfig dbus +apk add qt5-qtbase wkhtmltopdf --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted +mv /usr/bin/wkhtmltopdf /usr/bin/wkhtmltopdf-origin + +echo "#!/usr/bin/env sh" >/usr/bin/wkhtmltopdf +echo "Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &" >>/usr/bin/wkhtmltopdf +echo "DISPLAY=:0.0 wkhtmltopdf-origin $@" >>/usr/bin/wkhtmltopdf +echo "killall Xvfb" >>/usr/bin/wkhtmltopdf + +chmod +x /usr/bin/wkhtmltopdf -- GitLab