From a9e4c974ece36fe587ed82448a671ab16ebeb3e2 Mon Sep 17 00:00:00 2001
From: Felipe Weckx <felipe@lab3dvlp.com>
Date: Sun, 22 Aug 2021 07:55:27 -0300
Subject: [PATCH] added support for ioncube

---
 Dockerfile            | 9 +++++++++
 scripts/entrypoint.sh | 6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Dockerfile b/Dockerfile
index 645d10f..db40bc6 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -67,6 +67,12 @@ RUN curl -sS https://getcomposer.org/installer |  php -- --install-dir=/usr/loca
  && curl -o /usr/local/bin/phpunit -L https://phar.phpunit.de/phpunit.phar \
  && chmod +x /usr/local/bin/phpunit 
 
+# Install Ioncube
+RUN curl -o /tmp/ioncube-loader.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \
+ && cd /usr/local \
+ && tar zxvf /tmp/ioncube-loader.tar.gz \
+ && rm /tmp/ioncube-loader.tar.gz
+
 # Run as root
 RUN sed -i 's/www-data/root/' /usr/local/etc/php-fpm.d/www.conf
 
@@ -90,6 +96,9 @@ ENV PHP_FPM_MAX_SPARE_SERVERS 5
 # Copy php.ini
 COPY conf/php.ini.template /usr/local/etc/php/php.ini.template
 
+# Copy www.conf
+COPY conf/www.conf.template /usr/local/etc/php/www.conf.template
+
 # Set entrypoint
 COPY scripts/entrypoint.sh /usr/local/bin
 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh
index 892dab3..8cbaf21 100755
--- a/scripts/entrypoint.sh
+++ b/scripts/entrypoint.sh
@@ -19,8 +19,12 @@ if [ "$PHP_EXT_ENABLE" != "" ]; then
 	done
 fi
 
+if [ "$IONCUBE_ENABLE" == "true" ]; then
+	echo 'zend_extension = /usr/local/ioncube/ioncube_loader_lin_7.4.so' > /usr/local/etc/php/conf.d/10-ioncube.ini
+fi
+
 envsubst < /usr/local/etc/php/php.ini.template > /usr/local/etc/php/php.ini
 envsubst < /usr/local/etc/php/www.conf.template > /usr/local/etc/php-fpm.d/www.conf
 
 # Forward commands
-exec "$@"
\ No newline at end of file
+exec "$@"
-- 
GitLab